Reputation: 111
Given that I've got a ExtJS grid using a CheckBoxModel, what is the best way to get a list of all the records where the checkbox is checked?
Upvotes: 11
Views: 44036
Reputation: 828
In ExtJS 4, to select records in a grid with selection model as Ext.selection.CheckboxModel do:
var selectedRecords = grid.getSelectionModel().getSelection();
// And then you can iterate over the selected items, e.g.:
selected = [];
Ext.each(selectedRecords, function (item) {
selected.push(item.data.someField);
});
I hope this helps
Upvotes: 26
Reputation: 973
simply by using getSelection()
like this :
var selectedRecordsArray = grid.getView().getSelectionModel().getSelection();
Upvotes: 4
Reputation: 41
var SelectedCheckbox=grid.getSelectionModel();
for(i=0;i<SelectedCheckbox.selections.length;i++){
console.log(SelectedCheckbox.selections.items[i].data.field_name);
}
Upvotes: 0
Reputation: 31
var arrayList=[],
selected=Ext.getCmp('wpDetaPrdsDetailGrid').getView().getSelectionModel().getSelection();
Ext.each(selected, function (item) {
arrayList.push(item.data);
});
Upvotes: 3
Reputation: 160
Your grid checkbox question is addressed on the the Sencha Ext JS 3.x Community Forum.
Upvotes: 0