So selecting grid row value is easy:
handler: function(widget, event){
rec = grid.getSelectionModel().getSelection()[0];
console.log(rec.get('amount') + rec.get("price"));
}
This way, when user interacts with grid it simply retrieves data from its scope,
my question is how to retrieve specific data from specific rows? Lets say user clicks on third row from the top, how to select data from third, second and firs row, or fourth and firs(random)? I belive data ing from store is not in array, so calling array position isnt a option, or? Is there something like getPosition()
but position of row(s)?
Any ideas?
So selecting grid row value is easy:
handler: function(widget, event){
rec = grid.getSelectionModel().getSelection()[0];
console.log(rec.get('amount') + rec.get("price"));
}
This way, when user interacts with grid it simply retrieves data from its scope,
my question is how to retrieve specific data from specific rows? Lets say user clicks on third row from the top, how to select data from third, second and firs row, or fourth and firs(random)? I belive data ing from store is not in array, so calling array position isnt a option, or? Is there something like getPosition()
but position of row(s)?
Any ideas?
1 Answer
Reset to default 4You should set the "select" event from the Ext.selection.Model (which is probably cell or row). In that event you receive as parameters:
Ext.selection.RowModel: select( Ext.selection.RowModel this, Ext.data.Model record, Number index, Object eOpts ).
So from there you have the record as well as the index, if you want to get another record (for example the previous one) you should get it from the store like so:
record.store.getAt(index - 1)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745007331a4605860.html
评论列表(0条)