Skip to content

Commit

Permalink
Merge pull request #6438 from mloock/variant-grid
Browse files Browse the repository at this point in the history
Fix on object variant grid: batch edit for 'select' fields + batch edit all with selected items
  • Loading branch information
dvesh3 committed May 25, 2020
2 parents 00ce8f5 + 9bae4d6 commit c749232
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,17 +375,17 @@ pimcore.element.helpers.gridColumnConfig = {
for (var i = 0; i < selectedRows.length; i++) {
jobs.push(selectedRows[i].get("id"));
}
this.batchOpen(columnIndex, jobs, append, remove, true);
this.batchOpen(columnIndex, jobs, append, remove, onlySelected);

} else {
let params = this.getGridParams();
let params = this.getGridParams(onlySelected);
Ext.Ajax.request({
url: this.batchPrepareUrl,
params: params,
success: function (columnIndex, response) {
var rdata = Ext.decode(response.responseText);
if (rdata.success && rdata.jobs) {
this.batchOpen(columnIndex, rdata.jobs, append, remove, false);
this.batchOpen(columnIndex, rdata.jobs, append, remove, onlySelected);
}

}.bind(this, columnIndex)
Expand Down Expand Up @@ -414,7 +414,7 @@ pimcore.element.helpers.gridColumnConfig = {
}
// HACK END

if(this.objecttype == "object") {
if((this.objecttype === "object") || (this.objecttype === "variant")) {
if (!fieldInfo.layout || !fieldInfo.layout.layout) {
return;
}
Expand Down Expand Up @@ -692,7 +692,7 @@ pimcore.element.helpers.gridColumnConfig = {
this.buildColumnConfigMenu();
},

getGridParams: function () {
getGridParams: function (onlySelected) {
var filters = "";
var condition = "";
var searchQuery = this.searchField ? this.searchField.getValue() : "";
Expand Down Expand Up @@ -720,15 +720,17 @@ pimcore.element.helpers.gridColumnConfig = {
params["query"] = searchQuery;
}

//create the ids array which contains chosen rows to export
ids = [];
var selectedRows = this.grid.getSelectionModel().getSelection();
for (var i = 0; i < selectedRows.length; i++) {
ids.push(selectedRows[i].data.id);
}
if (onlySelected !== false) {
//create the ids array which contains chosen rows to export
ids = [];
var selectedRows = this.grid.getSelectionModel().getSelection();
for (var i = 0; i < selectedRows.length; i++) {
ids.push(selectedRows[i].data.id);
}

if (ids.length > 0) {
params["ids[]"] = ids;
if (ids.length > 0) {
params["ids[]"] = ids;
}
}

//tags filter
Expand Down

0 comments on commit c749232

Please sign in to comment.