Refactor to individual functions

This commit is contained in:
jamessspanggg 2020-01-20 23:20:14 +08:00
parent 90628e6ab0
commit 73936183bb

View File

@ -765,34 +765,12 @@ DataTableView.prototype._createMenuForAllColumns = function(elmt) {
{ {
label: $.i18n('core-views/fill-down'), label: $.i18n('core-views/fill-down'),
id: "core/fill-down", id: "core/fill-down",
click: function() { click: doAllFillDown
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
Refine.postCoreProcess(
"fill-down",
{
columnName: theProject.columnModel.columns[i].name
},
null,
{ modelsChanged: true }
);
}
}
}, },
{ {
label: $.i18n('core-views/blank-down'), label: $.i18n('core-views/blank-down'),
id: "core/blank-down", id: "core/blank-down",
click: function() { click: doAllBlankDown
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
Refine.postCoreProcess(
"blank-down",
{
columnName: theProject.columnModel.columns[i].name
},
null,
{ modelsChanged: true }
);
}
}
} }
] ]
}, },
@ -896,6 +874,32 @@ DataTableView.prototype._createSortingMenu = function(elmt) {
MenuSystem.createAndShowStandardMenu(items, elmt, { horizontal: false }); MenuSystem.createAndShowStandardMenu(items, elmt, { horizontal: false });
}; };
var doAllFillDown = function() {
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
Refine.postCoreProcess(
"fill-down",
{
columnName: theProject.columnModel.columns[i].name
},
null,
{ modelsChanged: true }
);
}
};
var doAllBlankDown = function() {
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
Refine.postCoreProcess(
"blank-down",
{
columnName: theProject.columnModel.columns[i].name
},
null,
{ modelsChanged: true }
);
}
};
DataTableView.prototype._updateCell = function(rowIndex, cellIndex, cell) { DataTableView.prototype._updateCell = function(rowIndex, cellIndex, cell) {
var rows = theProject.rowModel.rows; var rows = theProject.rowModel.rows;