Merge pull request #2296 from jamessspanggg/add-filldown-blankdown-for-all

[#2280] Add fill down and blank down operations for all columns
This commit is contained in:
Antonin Delpeuch 2020-01-27 10:24:08 +01:00 committed by GitHub
commit 5894041943
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -794,6 +794,17 @@ DataTableView.prototype._createMenuForAllColumns = function(elmt) {
click: function() {
new ColumnReorderingDialog();
}
},
{},
{
label: $.i18n('core-views/fill-down'),
id: "core/fill-down",
click: doAllFillDown
},
{
label: $.i18n('core-views/blank-down'),
id: "core/blank-down",
click: doAllBlankDown
}
]
},
@ -897,6 +908,50 @@ DataTableView.prototype._createSortingMenu = function(elmt) {
MenuSystem.createAndShowStandardMenu(items, elmt, { horizontal: false });
};
var doAllFillDown = function() {
doFillDown(theProject.columnModel.columns.length - 1);
};
var doFillDown = function(colIndex) {
if (colIndex >= 0) {
Refine.postCoreProcess(
"fill-down",
{
columnName: theProject.columnModel.columns[colIndex].name
},
null,
{modelsChanged: true},
{
onDone: function() {
doFillDown(--colIndex);
}
}
);
}
};
var doAllBlankDown = function() {
doBlankDown(0);
};
var doBlankDown = function(colIndex) {
if (colIndex < theProject.columnModel.columns.length) {
Refine.postCoreProcess(
"blank-down",
{
columnName: theProject.columnModel.columns[colIndex].name
},
null,
{ modelsChanged: true },
{
onDone: function() {
doBlankDown(++colIndex);
}
}
);
}
};
DataTableView.prototype._updateCell = function(rowIndex, cellIndex, cell) {
var rows = theProject.rowModel.rows;