Tuesday, 7 October 2008

[ExtJs] get data from grid

=== 1 ===================
grid.getSelectionModel().on('rowselect', function(sm, rowIdx,r){

alert(r.data.my_id+" : "+r.data.organization);
alert(rowIdx);
alert(grid.getSelectionModel().getCount());
alert(grid.getSelectionModel().getSelected().get('my_id'));

//bookTpl.overwrite(detailPanel.body, r.data);
});
=== 2 =================================

var getData = grid.getSelectionModel().getSelected();
alert(getData.get('my_id'));

=== 3: multi selection =================================

var getData = grid.getSelections();
for (var i = 0 ; i < getData.length ;i++) {
alert(getData[i].get('my_id'));
}

7 comments:

Anonymous said...

Thanks!! your example is very useful.

Anonymous said...

very useful - thanks.

Arulmurugan said...

hi very useful thanks.

James said...

Help me, thanks :)

Anonymous said...

=== 3: multi selection

var getData = grid.getSelections();
for (var i = 0 ; i < getData.length ;i++) {
alert(getData[i].get('my_id'));
}

In Ext 3.0 this example not works, this would be grid.getSelectionModel().getSelections();

Anonymous said...

Thanks, this is help me...

imane said...

thanksssssssss