Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Carlos Macías on Oct 29, 2008 05:48
open dhtmlx forum
Javascript error with filter and enableSmartXMLParsing

Hi everybody,

I've a two-level treegrid with a filters and enableSmartXMLParsing true (default).

I need that in the parents rows show me the sumatory of all children rows. In the first load (without filters) de =sum works perfectly, but when I filter by some value, the =sum not work until I expand the nodes.

I've been searching in your knowledge base and I know that setting the enableSmartXMLParsing to false, the =sum working correctly, isn´t it?

Anyway, I set the enableSmartXMLParsing to false to probe this issue, but now the filtering not work, the firefox shows me that error:
c is null in dhtmlxgrid.js
Line 882

How could resolves this?

Thanks in advance.
Answer posted by Support on Oct 29, 2008 07:05
>>that setting the enableSmartXMLParsing to false, the =sum working correctly, isn´t it?
It necessary for any TreeGrid which may contain more than two levels of data. If you are sure that your treegrid will always have 2 levels of data - you can have smartXMLParsing  enabled. 

You can try to add next code to the grid's initialization

mygrid.attachEvent("onFilterEnd",function(){
  mygrid.callEvent("onXLE",[])
 })

It will force =sum recalculation after filter applied


Answer posted by Carlos Macías on Oct 29, 2008 07:52
Thank you for your answer.

I've added your code, but not work. Maybe because I don't use a built in filter (i.e. #text_filter)?, I am using "filterby" function.
Can It be?
Answer posted by Support on Oct 29, 2008 08:21
If you are using direct API call, it must be as

mygrid.filterBy(some,some);
mygrid.callEvent("onXLE",[])
Answer posted by Carlos Macías on Oct 29, 2008 09:13
Thank you very much, works perfectly!!!!