我创建了一个View extend Ext.grid.Panel并附加了一个tbar,在工具栏中我得到了2个按钮[Add]和[Remove]在这个问题中我只专注于[Remove]命令.
像往常一样,我想抓住我要删除的网格中当前选定的记录.
所以在控制器中:
init: function() {
this.control({
'extendgridlist button[action=remove]': {
click: this.removeCurrentRow;
}
});
}
removeCurrentRow: function(t){
// how do i get current selected record
}
Run Code Online (Sandbox Code Playgroud)
removeCurrentRow: function(t){
var grid = t.up('gridpanel');
var arraySelected =grid.getSelectionModel().getSelection();
//assuming you have a single select, you have the record at index 0;
var record = arraySelected[0]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6917 次 |
| 最近记录: |