如何从ExtJS网格中获取使用checkboxmodel的选定记录

Ste*_*eve 11 javascript extjs

鉴于我使用CheckBoxModel获得了ExtJS网格,获取复选框所有记录列表的最佳方法是什么?

pab*_*car 23

在ExtJS 4中,选择具有选择模型的网格中的记录为Ext.selection.CheckboxModel:

var s = grid.getSelectionModel().getSelection();
// And then you can iterate over the selected items, e.g.: 
selected = [];
Ext.each(s, function (item) {
  selected.push(item.data.someField);
});
Run Code Online (Sandbox Code Playgroud)

我希望这有帮助

  • 您还可以执行以下操作以保存几行:Ext.pluck(grid_selection,'data') (2认同)

小智 0

您的网格复选框问题已在 Sencha Ext JS 3.x 社区​​论坛上得到解决。