-修正删除当前选中的新增行时总是删除第一行的问题(lrjnew-8004)。

-新增行之前先清空当前选中的单元格。
This commit is contained in:
三生石上 2016-02-29 05:40:15 -05:00
parent 3c1d7c8fda
commit ea1604634e
2 changed files with 65 additions and 10 deletions

View File

@ -898,6 +898,7 @@ if (Ext.grid.Panel) {
var store = me.getStore();
Ext.Array.each(selection, function (record, index) {
// 晕倒:新增行的 record.getId() 居然为 undedined没办法
selectedRows.push(record.getId());
});
}
@ -1137,22 +1138,67 @@ if (Ext.grid.Panel) {
},
// 获取选中的行
f_getSelectedRows: function () {
var selectedRows = [];
var sm = this.getSelectionModel();
if (sm.getSelection) {
var selection = sm.getSelection();
var store = this.getStore();
Ext.Array.each(selection, function (record, index) {
selectedRows.push(store.indexOf(record));
});
}
return selectedRows;
},
// 仅内部使用f_deleteSelectedRows
f_getSelectedRowsIndex: function () {
var selectedRows = [];
var sm = this.getSelectionModel();
if (sm.getSelection) {
var selection = sm.getSelection();
var store = this.getStore();
Ext.Array.each(selection, function (record, index) {
selectedRows.push(store.indexOf(record));
});
}
return selectedRows;
},
// 仅内部使用f_deleteSelectedRows
f_getSelectedCellIndex: function () {
var selectedCell = [], currentPos;
var sm = this.getSelectionModel();
if (sm.getCurrentPosition) {
currentPos = sm.getCurrentPosition();
if (currentPos) {
selectedCell = [currentPos.row, currentPos.columnHeader.f_columnIndex];
}
}
return selectedCell;
},
// 从Store中删除选中的行或者单元格
f_deleteSelectedRows: function () {
var me = this;
var store = me.getStore();
var $this = this;
var store = this.getStore();
var sm = me.getSelectionModel();
var sm = this.getSelectionModel();
if (sm.getSelection) {
var rows = me.f_getSelectedRows();
Ext.Array.each(rows, function (rowId, index) {
store.remove(store.getById(rowId));
var rows = this.f_getSelectedRowsIndex();
Ext.Array.each(rows, function (rowIndex, index) {
store.removeAt(rowIndex);
});
} else if (sm.getSelectedCell) {
var selectedCell = me.f_getSelectedCell();
var selectedCell = this.f_getSelectedCellIndex();
if (selectedCell.length) {
store.remove(store.getById(selectedCell[0]));
store.removeAt(selectedCell[0]);
}
}
},
@ -1179,8 +1225,14 @@ if (Ext.grid.Panel) {
}
*/
// 清空当前选中的单元格
me.getSelectionModel().setCurrentPosition();
me.f_cellEditing.cancelEdit();
// 取消正在编辑
me.f_cellEditing.cancelEdit();
var newAddedRecords;
//var rowIndex = 0;

View File

@ -30,7 +30,10 @@ FineUI 严格遵守 ExtJS 对开源软件的规定,不再内置 ExtJS 库,
发布历史
+2016-05-** v4.2.4
-修正选中表格中不存在行时出错的问题yygy-8066
+表格增强。
-修正选中不存在行时出错的问题yygy-8066
-修正删除当前选中的新增行时总是删除第一行的问题lrjnew-8004
-新增行之前先清空当前选中的单元格。