extjs grid 使用多选框

使用选择框的选择模型是checkboxmodel,代码如下:

xtype: "grid",
store: myStore,
selModel: {
    mode: 'SIMPLE',
    selType: 'checkboxmodel',
    allowDeselect: true,
    bindCheckedField: 'ISCHECKED'
},
columns: [
    { xtype: "rownumberer", text: "行号", width: 50 },
    { text: "姓名", dataIndex: "Name" },
    { text: "年龄", dataIndex: "Age" }
]

效果如图:

ExtJS,grid多选框列

extjs grid 获取选中行

要得到选中行,我们首先要找到grid,然后得到grid的selectionModel,然后再找到选择行,代码如下:

var grid = win.down("grid");
var records = grid.getSelectionModel().getSelection();
Ext.MessageBox.alert("提示", records.length);

自用参考代码(js分离时的写法):

        var me = this,
        records = me.view.selection();
        Ext.MessageBox.alert("提示", records.length);

 

相关文章:

  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2021-10-05
  • 2021-10-19
  • 2021-05-21
  • 2021-05-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
相关资源
相似解决方案