Skip to content

Added functionality to add go to edit page button on admin grid inline edit #27614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.4-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
<item name="saveUrl" xsi:type="url" path="cms/page/inlineEdit"/>
<item name="validateBeforeSave" xsi:type="boolean">false</item>
</param>
<param name="editUrl" xsi:type="url" path="cms/page/edit/page_id/:id"></param>
<param name="indexField" xsi:type="string">page_id</param>
<param name="enabled" xsi:type="boolean">true</param>
<param name="selectProvider" xsi:type="string">cms_page_listing.cms_page_listing.cms_page_columns.ids</param>
Expand Down
21 changes: 21 additions & 0 deletions app/code/Magento/Ui/view/base/web/js/grid/editing/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,27 @@ define([
return this;
},

/**
* Redirect to Edit page.
*/
redirectToEdit: function () {
var rowData = this.getData()[_.keys(this.getData())[0]],
indexFieldValue = (typeof rowData[this.indexField] != "undefined") ? rowData[this.indexField] : "";

if (indexFieldValue) {
window.location.href = decodeURIComponent(this.editUrl).replace(":id", indexFieldValue);
}
},

/**
* Check Edit url is defined in xml.
*
* @returns {Boolean}
*/
hasEditUrl: function () {
return (typeof this.editUrl != "undefined") ? true : false;
},

/**
* Validates all active records.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
<button class="action-primary" type="button" click="save" disable="!canSave()">
<span translate="'Save'"/>
</button>
<button class="action-tertiary" type="button" click="redirectToEdit" visible="hasEditUrl()">
<span translate="'Edit'"/>
</button>
</td>
</tr>