-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
Fixed cannot sort by column in backend's grids #3985
Conversation
This reverts commit 4133824.
Sorry, but the patch solves the sorting issues in the default grid, The problem is here: 91b1944 I have also try to change attribute name to data-name and update it here but not resolve the issues, the sorting and filters are not working. |
did you try element.parentNode.dataSet.columnId? |
Tried now, but it doesn't work. |
True, the tag ID should be used instead. We should find a solution for these old, widely used extensions. For example, I was thinking of creating a dedicated clone repository of OpenMage and keep it updated then store all patches in the PRs then keep synchronized with the main one. |
Sorry, for it to work, we also need to revert " js/mage/adminhtml/grid.js" to version 20.6.0 https://raw.githubusercontent.com/OpenMage/magento-lts/v20.6.0/js/mage/adminhtml/grid.js ---
js/mage/adminhtml/grid.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/js/mage/adminhtml/grid.js b/js/mage/adminhtml/grid.js
index 55eb3b2ef05..9e2a168e5d4 100644
--- a/js/mage/adminhtml/grid.js
+++ b/js/mage/adminhtml/grid.js
@@ -141,15 +141,15 @@ varienGrid.prototype = {
},
doSort : function(event){
- var element = Event.findElement(event, 'a');
+ event.preventDefault();
+ const element = event.target.closest('a');
+ const parentElement = element.parentNode;
- if(element.name && element.title){
- this.addVarToUrl(this.sortVar, element.name);
+ if (element && parentElement && parentElement.dataset.columnId && element.title) {
+ this.addVarToUrl(this.sortVar, parentElement.dataset.columnId);
this.addVarToUrl(this.dirVar, element.title);
this.reload(this.url);
}
- Event.stop(event);
- return false;
},
loadByElement : function(element){
if(element && element.name){ |
done |
For those who want to fix it immediately 20.0.7 without downgrade, you can apply the patch like this: {
[...]
"require": {
"aydin-hassan/magento-core-composer-installer": "~2.1.0",
"openmage/magento-lts": "^20.7.0",
[...]
"extra": {
"enable-patching": true,
[...]
"patches": {
"openmage/magento-lts": {
"Fixed cannot sort by column in backend's grids #3985": "https://patch-diff.githubusercontent.com/raw/OpenMage/magento-lts/pull/3985.patch"
}
}
} |
I don't understand how the js thing can happen but whatever :-\ |
#3927 broke grid sorting functionality in the backend because the js was looking for the "name" attribute.
This PR rewrites the doSort methods fixing the bug