Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14174 closed defect (fixed)

EnhancedGrid NestedSorting plugin does not work properly with DnD plugin for columns

Reported by: keithjjones Owned by: Evan
Priority: blocker Milestone: 1.7.1
Component: DojoX Grid Version: 1.6.1
Keywords: nestedsorting dnd enhancedgrid column grid Cc:
Blocked By: Blocking:

Description

I had a problem in an application I was developing with Dojo v1.7.0 (released Oct 27 2011) and checked to see if the bug was in previous versions of Dojo. It was. I verified it with the EnhcancedGrid? example on the Dojo main website here:

http://dojotoolkit.org/grids-charts

To reproduce the bug, you can use the following steps:

Sort on a column such as "Year". Select a column to the right of the sorted column, such as "Album". DnD (Move) the selected column somewhere to the left of a sorted column. The grid will now report a different column as being sorted than the true column used for the sort. I have also verified through JsonRest? network traffic that the grid truly believes it is sorted by the original sort column even though the rendering reports otherwise. The rendering on the page appears to be incorrect and does not reflect the true sorting criteria.

I originally found this bug when the following line (line 33 in Dojo v1.7.0) caused an error in NestedSorting?.js:

"var idx=this._getRegionHeader(cr).getAttribute("idx");"

This was under the function "_onColumnDnD:function(_e,_f)". ".getAttribute("idx")" could not be executed because it was being called upon either a null or undefined value. I believe that was causing some other rendering problems I was experiencing when moving columns around in Chrome, but could not reproduce the results consistently.

I have tested this bug in IE9 [compat mode on and off - note that I've also tested Dojo v1.7.0 (released Oct 27, 2011) and this bug exists], Chrome v15.0.874.106, and FireFox? v7.0.1. I do not have any script blockers enabled in any of the browsers. All three browsers experience this bug.

The only workaround I can find at this time is to not enable NestedSorting? and DnD (for columns) together.

Please feel free to contact me for any further clarification you may need.

Change History (8)

comment:1 Changed 8 years ago by Evan

Resolution: duplicate
Status: newclosed

This is duplicate and already fixed with #12649

Please try the latest 1.7 version - by turning on both NestedSorting? and DnD

BTW, seems http://dojotoolkit.org/grids-charts is not using the latest code base, we will try to fix the page soon for 1.7.

Thanks!

comment:2 Changed 8 years ago by Evan

Milestone: tbd1.7

comment:3 in reply to:  1 Changed 8 years ago by keithjjones

Resolution: duplicate
Status: closedreopened

Replying to Evan:

This is duplicate and already fixed with #12649

Please try the latest 1.7 version - by turning on both NestedSorting? and DnD

BTW, seems http://dojotoolkit.org/grids-charts is not using the latest code base, we will try to fix the page soon for 1.7.

Thanks!

Thank you for the info. I do see that it works in the test you pointed me to. However, the bug is still in 1.7.0 that was released on Oct 27, 2011. I am not sure what the difference could be.

I am using 1.7.0-release in the application I am developing, but in my original bug submission I was also showing that this problem is in 1.6.1 as well. It is still a bug in 1.7.0 that was released on Oct 27, 2011 too.

If you edit the NestedSorting?.js file to have the following logic, it appears to fix the bug (and also does not try to call a function of a null or undefined value). Note that it may break other things in Dojo's code, but it at least addresses the bug I am reporting:

_onColumnDnD: function(type, mapping){

summary: Update nested sorting after column moved if(type !== 'col'){return;} var m = mapping, obj = {}, d = this._sortData, p; for(p in m){

if(d[p]){

obj[m[p]] = d[p]; delete d[p];

}

} for(p in obj){

d[p] = obj[p];

} this._initSort(false);

},

This is what is currently in 1.7.0 released on October 27, 2011 and does not reflect #12649 that you pointed out:

_onColumnDnD: function(type, mapping){

summary: Update nested sorting after column moved if(type !== 'col'){return;} var m = mapping, obj = {}, d = this._sortData, p; var cr = this._getCurrentRegion(); this._blurRegion(cr); var idx = this._getRegionHeader(cr).getAttribute('idx'); for(p in m){

if(d[p]){

obj[m[p]] = d[p]; delete d[p];

} if(p === idx){

idx = m[p];

}

} for(p in obj){

d[p] = obj[p];

} var c = this._headerNodes[idx]; this._currRegionIdx = array.indexOf(this._getRegions(), c.firstChild); this._initSort(false);

},

Am I missing something between the 1.7 version used in the test and the 1.7.0 version released on Oct 27?

This is the file I am referring to:

http://download.dojotoolkit.org/release-1.7.0/dojo-release-1.7.0/dojox/grid/enhanced/plugins/NestedSorting.js

Thank you so much for your help!

comment:4 Changed 8 years ago by keithjjones

I may have been incorrect when I said the test you listed worked. I have verified the test you listed above for 1.7.0 also has the same bug. Try this:

Enable NestedSorting? Enable DnD

Create the grid

Sort on Genre. Select Genre's column. Move it to the right of Album.

Depending on the browser you are using, you get different results. In Chrome and Firefox the Genre column even moves to the right of Name (not where I put it) and the sort is now reported on the Artists column even though it is still sorted on Genre. In IE (with and without compatibility mode) the same thing happens except now it reports the grid is sorted on Name even though it is sorted on Genre.

I used all the same versions of browsers reported in my original bug report.

I tested moving columns in many different ways and it seems this bug still exists.

comment:5 Changed 8 years ago by Evan

Resolution: fixed
Status: reopenedclosed

In [26949]:

Fixes #14174 !strict by fixing a regression when DnD(Rearrange) used with NestedSorting?, also back port to 1.7.1 branch

comment:6 in reply to:  4 Changed 8 years ago by Evan

Replying to keithjjones:

I may have been incorrect when I said the test you listed worked. I have verified the test you listed above for 1.7.0 also has the same bug. Try this:

Enable NestedSorting? Enable DnD

Create the grid

Sort on Genre. Select Genre's column. Move it to the right of Album.

Depending on the browser you are using, you get different results. In Chrome and Firefox the Genre column even moves to the right of Name (not where I put it) and the sort is now reported on the Artists column even though it is still sorted on Genre. In IE (with and without compatibility mode) the same thing happens except now it reports the grid is sorted on Name even though it is sorted on Genre.

I used all the same versions of browsers reported in my original bug report.

I tested moving columns in many different ways and it seems this bug still exists.

Yep, it's actually a regression in DnD itself, fixed with [26949], also back ported to 1.7.1 branch.

Thanks keithjjones! You may verify with the latest nightly build and please let me know if that works for you.

comment:7 Changed 8 years ago by Evan

Milestone: 1.71.7.1

comment:8 in reply to:  7 Changed 8 years ago by keithjjones

Replying to Evan:

Looks like the nightly build works! Thanks!

I'm glad I could help. I wish I knew the source code well enough to find that bug on my own!

Note: See TracTickets for help on using tickets.