Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Anna San Valentin on Dec 07, 2007 14:05
open dhtmlx forum
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<img src=/image/requiredCheck.gif />,Owner,Type,Priority,Start Date<img src=/image/requiredCheck.gif />,Target Date<img src=/image/requiredCheck.gif />,Seq,Status<img src=/image/requiredCheck.gif />,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"?>
<rows>
<row id="1176440">
<cell>/image/icons/navigate.gif^/dyn/project/scopeTaskInfo.pa?showHeaders=false&ptid=4&projectid=1175767&showThisMenuGroupOnly=true&pid=1175767&taskid=1176440&x=1197057463875&scopeid=1176440</cell>
<cell><![CDATA[]]></cell>
<cell>Work Summary</cell>
<cell></cell>
<cell>Rollout</cell>
<cell></cell>
<cell>12/03/2007</cell>
<cell>03/28/2008</cell>
<cell>999</cell>
<cell>In Progress</cell>
<cell>0.00</cell>
<cell>0.00</cell>
<cell>0.00%</cell>
<cell>5</cell>
<row id="1191598">
<cell>/image/icons/navigate.gif^/dyn/project/scopeTaskInfo.pa?showHeaders=false&ptid=5&projectid=1175767&showThisMenuGroupOnly=true&pid=1176440&taskid=1191598&x=1197057463890&scopeid=1176440</cell>
<cell><![CDATA[]]></cell>
<cell>Item One</cell>
<cell></cell>
<cell></cell>
<cell></cell>
<cell>12/03/2007</cell>
<cell>03/28/2008</cell>
<cell>999</cell>
<cell>In Progress</cell>
<cell>0.00</cell>
<cell>0.00</cell>
<cell>0.00%</cell>
<cell>5</cell>
</row>
<row id="1191650">
<cell>/image/icons/navigate.gif^/dyn/project/scopeTaskInfo.pa?showHeaders=false&ptid=5&projectid=1175767&showThisMenuGroupOnly=true&pid=1176440&taskid=1191650&x=1197057463906&scopeid=1176440</cell>
<cell><![CDATA[]]></cell>
<cell>Item Two</cell>
<cell></cell>
<cell></cell>
<cell></cell>
<cell>12/03/2007</cell>
<cell>03/28/2008</cell>
<cell>999</cell>
<cell>In Progress</cell>
<cell>0.00</cell>
<cell>0.00</cell>
<cell>0.00%</cell>
<cell>5</cell>
</row>
</row>
</rows>
Answer posted by Support on Dec 10, 2007 02:05
>> 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?
Answer posted by Anna San Valentin on Dec 10, 2007 08:45

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.

Answer posted by Support on Dec 10, 2007 10:09
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.