Skip to content

Commit

Permalink
NEW Allow state to be passed back on grid field actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ScopeyNZ committed Nov 21, 2018
1 parent 5d45c7d commit ccabba8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

31 changes: 24 additions & 7 deletions client/src/legacy/GridField.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,26 @@ $.entwine('ss', function($) {
}
}

this.getGridField().reload(
var data = [
{
data: [{
name: this.attr('name'),
value: this.val(),
filter: filterState,
triggerChange
}],
name: this.attr('name'),
state: 'abc',
value: this.val(),
filter: filterState,
triggerChange
},
];

var actionState = this.data('action-state');
if (actionState) {
data.push({
name: 'ActionState',
value: encodeURIComponent(JSON.stringify(actionState)),
});
}

this.getGridField().reload(
{ data },
successCallback
);

Expand All @@ -402,6 +413,12 @@ $.entwine('ss', function($) {
data += "&SecurityID=" + encodeURIComponent(csrf);
}

// Add action data
var actionState = this.data('action-state');
if (actionState) {
data += '&ActionState=' + encodeURIComponent(JSON.stringify(actionState))
}

// Include any GET parameters from the current URL, as the view
// state might depend on it. For example, a list pre-filtered
// through external search criteria might be passed to GridField.
Expand Down

0 comments on commit ccabba8

Please sign in to comment.