dhtmlXTreeGrid Sorting (JavaScript errors)

Greetings, hope all is well.



I am currently upgrading our dhtml toolkit to version 1.4 Pro. I noticed that sorting no longer works on a hierarchy. I looked in the KB archive and made sure that the row ids are unique but it didn’t seem to matter. I even tried just a simple tree with 3 items.



The error I get is “_childIndexes is null” – this is in the “this.cells = function(row_id, col)” call. Any info is greatly appreciated. Thanks in advance.



Here is how I initialize the grid:



mygrid = new dhtmlXGridObject(‘gridbox’);

mygrid.setHeader(“.,H,Title,Owner,Type,Priority,Start Date,Target Date,Seq,Status,Actual Hrs,Hrs To Comp,% Complete,ETID”);

mygrid.setInitWidths(“32,24,200,100,100,100,100,100,100,100,100,100,100,0”);

mygrid.setColAlign(“center,left,left,left,left,left,right,right,right,left,right,right,right,left”);

mygrid.setColTypes(“img,ro,tree,coro,coro,coro,dhxCalendarA,dhxCalendarA,ed,coro,ro,ro,ro,ro”);

mygrid.setColSorting(“na,na,str,str,str,str,date,date,int,str,int,int,int,int”);

mygrid.enableSmartXMLParsing(true);

mygrid.enablePaging(true,20,null,“pagingArea”,true,“recinfoArea”);



Here is the xml of 3 items:



<?xml version="1.0" encoding="UTF-8"?>





/image/icons/navigate.gif^/dyn/project/scopeTaskInfo.pa?showHeaders=false&ptid=4&projectid=1175767&showThisMenuGroupOnly=true&pid=1175767&taskid=1176440&x=1197057463875&scopeid=1176440



Work Summary



Rollout



12/03/2007

03/28/2008

999

In Progress

0.00

0.00

0.00%

5



/image/icons/navigate.gif^/dyn/project/scopeTaskInfo.pa?showHeaders=false&ptid=5&projectid=1175767&showThisMenuGroupOnly=true&pid=1176440&taskid=1191598&x=1197057463890&scopeid=1176440



Item One







12/03/2007

03/28/2008

999

In Progress

0.00

0.00

0.00%

5





/image/icons/navigate.gif^/dyn/project/scopeTaskInfo.pa?showHeaders=false&ptid=5&projectid=1175767&showThisMenuGroupOnly=true&pid=1176440&taskid=1191650&x=1197057463906&scopeid=1176440



Item Two







12/03/2007

03/28/2008

999

In Progress

0.00

0.00

0.00%

5





mygrid.enablePaging(true,20,null,“pagingArea”,true,“recinfoArea”);
I’m not sure what purpose of this line?
Paging not works in treegrid mode ( and it was the same with older versions of treegrid as well ), using paging can cause really strange effects on treeGrid hierarchy.

>>The error I get is “_childIndexes is null” – this is in the
“this.cells = function(row_id, col)” call. Any info is greatly
appreciated. Thanks in advance.

The error itself occurs when command against not existing row executed  ( rowID not exists or incorrect row index )

I created the sample from provided code snippet and XML , and it works correctly for me ( if you need such working sample - please contact at support@dhtmlx.com )

Do you initiate sorting by clicking on row header, or by js command? In second case , can it be that you init sorting even before dataset loaded?

>>to version 1.4 Pro.
You are using latest dhtmlxgrid 1.4 build 71022, right?


Thanks for your response and help.



I am currently using on v1.4 beta 70605.  (I guess it’s a pretty outdated version.  That was the last version update that was sent to us.)



I did try to remove the paging, but the error still occurs.  I don’t have any pre-Sort calls attached to the sort action when clicking on the column headers.  I’m sorting via clicking on the column headers.



Here is what IE’s (MS Visual Studio) debugger points to when the script errors out:



‘_childIndexes’ is null or not an object



And the debugger sets a break at:



 this.cells = function(row_id, col) { if (arguments.length == 0) return this.cells4(this.cell); else var c = this.getRowById(row_id); var cell = (c._childIndexes ? c.childNodes[c._childIndexes[col]] : c.childNodes[col]); return this.cells4(cell); };



I tried debugging this function.  Here, the value of row_id being passed is “undefined”.  (Immediately after when I click on a column header to sort.)



The code I have is pretty simple.  I don’t have any pre or post functions.  I’m now suspecting it must be my outdated toolkit version.

Please contact us directly at support@dhtmlx.com and provide your ref. number , the version which you contain was a first after new TreeGrid core implementation, so it have some problems - we will send you fixed versions of js. files.