Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by David Charron on Sep 23, 2009 10:11
open dhtmlx forum
Grid grouping (groupBy) with stat_total using xml

Hi,

I want to do the following using XML

myGrid.groupBy(0,["#title","#cspan","#cspan","#cspan","#cspan","#cspan","#cspan","#cspan","#cspan","#cspan","#cspan","#cspan","#cspan","#stat_total","#cspan","#cspan","#cspan","#cspan"]);

The following works but I cannot find out how to pass the 2nd parameter (specifying a stat_total) using XML
<call command='groupBy'>
<param>0</param>
</call>

Can you tell me how to pass the 2nd parameter (string array) to the command groupBy using xml call command?

Thank you.
Answer posted on Sep 28, 2009 01:23
All parameters passed through XML to a method are treated as strings. As long as there is no way  to represent array as single string, there is no way to pass array through call/param tag. But you can add your own wrapper for groupBy method, which will expect string:

dhtmlXGridObject.prototype.groupBy_wrp=function(){
var ar = Array();
for(var i=1;i<arguments.length;i++)
ar[ar.length] = arguments[i];
this. groupBy(arguments[0],ar)
}

And in call tag use groupBy_wrp. All parameters after the first one will be treated as array members

<call command=” groupBy_wrp”><param>1</param><param>#title</param><param>#title</param></call>