Utilise callbacks to chain fill/blank down operations

This commit is contained in:
jamessspanggg 2020-01-21 01:56:03 +08:00
parent 73936183bb
commit d7d4731f80

View File

@ -875,27 +875,45 @@ DataTableView.prototype._createSortingMenu = function(elmt) {
}; };
var doAllFillDown = function() { var doAllFillDown = function() {
for (var i = 0; i < theProject.columnModel.columns.length; i++) { doFillDown(0);
};
var doFillDown = function(colIndex) {
if (colIndex < theProject.columnModel.columns.length) {
Refine.postCoreProcess( Refine.postCoreProcess(
"fill-down", "fill-down",
{ {
columnName: theProject.columnModel.columns[i].name columnName: theProject.columnModel.columns[colIndex].name
}, },
null, null,
{ modelsChanged: true } {modelsChanged: true},
{
onDone: function() {
doFillDown(++colIndex);
}
}
); );
} }
}; };
var doAllBlankDown = function() { var doAllBlankDown = function() {
for (var i = 0; i < theProject.columnModel.columns.length; i++) { doBlankDown(0);
};
var doBlankDown = function(colIndex) {
if (colIndex < theProject.columnModel.columns.length) {
Refine.postCoreProcess( Refine.postCoreProcess(
"blank-down", "blank-down",
{ {
columnName: theProject.columnModel.columns[i].name columnName: theProject.columnModel.columns[colIndex].name
}, },
null, null,
{ modelsChanged: true } { modelsChanged: true },
{
onDone: function() {
doBlankDown(++colIndex);
}
}
); );
} }
}; };