Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get selected records from ExtJS grid that uses a checkboxmodel

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?

like image 364
Steve Avatar asked Jul 19 '11 14:07

Steve


3 Answers

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

like image 137
pablodcar Avatar answered Oct 22 '22 13:10

pablodcar


simply by using getSelection() like this :

var selectedRecordsArray = grid.getView().getSelectionModel().getSelection();
like image 33
aswininayak Avatar answered Oct 22 '22 14:10

aswininayak


var arrayList=[],
 selected=Ext.getCmp('wpDetaPrdsDetailGrid').getView().getSelectionModel().getSelection();
                    Ext.each(selected, function (item) {
                       arrayList.push(item.data);                    
});
like image 2
zengsong Avatar answered Oct 22 '22 15:10

zengsong