将选中的行先删除在插入,实现上下移动的效果。
var grid = Ext.getCmp('accessCPGridPanel');
var store = grid.getStore();
var record = grid.getSelectionModel().getSelected();
var index = store.indexOf(record);
//上移
if (index > 0) {
store.removeAt(index);
store.insert(index - 1, record);
grid.getSelectionModel().selectRow(index - 1);
}
//下移
if (index < store.getCount() - 1) {
store.removeAt(index);
store.insert(index + 1, record);
grid.getSelectionModel().selectRow(index + 1);
}
1 楼
ryon
2010-11-26
MARK!这个我找了好久了 感谢下~~