I will like to add the total of record, and the sum of prices of one column in the jsp page (not as part of the grid)… how I can?
This is my script code:
…
mygrid = new dhtmlXGridObject(‘gridbox’);
mygrid.setHeader("id, name ,price,…
mygrid.setColTypes( "ro,ro…
mygrid.init();
mygrid.enablePagingWT(true,12,0,“recinfoArea”);
mygrid.loadXML(loadDataURL);
This in my HTML code:
…
Total records ??? Total Amount $ ???
…
While
the main purpose of statistics counters is to show data inside the
headers|footers of the grid, it is pretty easy to use them to fill some
custom area on the page with the related data.
For example, if you have the following code:
grid._in_header_stat_count=function(tag,index,c){ //shortcut for statistics counterAnd somewhere on the page you have:
var calck=function(){
// define the function
which will be used for calculations
return this.getRowsNum();
}
this._stat_in_header(tag,calck,index,c); //call the default statistics handler processor
}
there are rows in my gridYou can link stat_count to the span element in the following way:
grid._in_header_stat_count(document.getElementById(‘grid_count’),1);After such command the content of grid_count element will be always equal to the number of rows in the grid.
One
cool detail should be noted here: if you add|delete the rows or reload
the grid, the content of html tag will be correctly updated after each
operation.
The same trick can be used with any “in header shortcut”, but there is no much sense in it for the static ones.
i’ve changed my code but it cant get it to work, here is it:
This is my script code:
…
mygrid = new dhtmlXGridObject(‘gridbox’);
mygrid.setHeader("id, name ,price,…
mygrid.setColTypes( "ro,ro…
mygrid.init();
mygrid._in_header_stat_count=function(tag,index,c){ var calck=function(){ return this.getRowsNum(); } this._stat_in_header(tag,calck,index,c); }
mygrid._in_header_stat_count(document.getElementById(‘grid_count’),1);
mygrid.enablePagingWT(true,12,0,“recinfoArea”);
mygrid.loadXML(loadDataURL);
This in my HTML code:
…
Total records
…