Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Julien Pellet on Sep 12, 2008 01:49
open dhtmlx forum
dhtmlXgrid : Smart Rendering total_count parameter ... and serializeToCSV

Hello,

I had a problem before with smart rendering (i don't know the total_count parameter : issue is here http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=4911).
My solution was to count how many rows i will have on the next update, and then increment the table :

...
mygrid.attachEvent("onXLE",updateTotalCount);
...
    function updateTotalCount(){
        var current_count=mygrid.rowsBuffer.length;
        var params=createParamList()+"&posStart="+current_count;
        try {
            var url="ajax/getNextCount.php?"+params;
            var loader = new net.ContentLoader(url,parseUpdateTotalCountXml,null,"POST");
            var loader = null ;
        } catch(e) {}
    }


    function parseUpdateTotalCountXml() {
        try {
            var xmlDoc=this.req.responseXML;
            var nextCount=xmlDoc.getElementsByTagName('nextCount').item(0).childNodes[0].nodeValue;
            if (nextCount >= mygrid.rowsBuffer.length) {
                mygrid.rowsBuffer[nextCount]=null;
                mygrid._reset_view();
            }
        } catch(e) {}
    }


But now, I need to serialize this grid to CSV. I believe that serialization is working up to my new limit because if i comment "mygrid.rowsBuffer[nextCount]=null;" this is working fine.
If i don't , i get a "r.childNodes is undefined" error in dhtmlxgrid_nxml.js .

Can you please help me?

Thanks ,

Julien PELLET
Answer posted by Support on Sep 12, 2008 05:18
The serialization functionality ( both to XML and to CSV ) can work only with data loaded to client side. 
In your case - part of data loaded to client side, part is still awaited from server ( because of custom modificaitons ) - as result grid process already loaded rows correctly but fails to serialize not loaded data ( which is logical - such data just not available on client side )

Technically , this is expected behavior, grid can't serialize not loaded data ( serialization fails the same in case of normal dyn. smart rendering or dyn. paging, where not all data loaded on client )
By some code modification , it possible to force serialization of only loaded rows and ignore not loaded ones - please inform if you need details. 
Answer posted by Julien PELLET on Sep 12, 2008 05:35
Ok, i will try to resize the grid to the real size before to serialize.
I agree that this is logical, but with no modifications, I can't serialize with wmart rendering when all datas aren't loaded.
I think that it should be logical (also) to serialize only displayed datas.

Thanks anyway, i'll contact you another time if i don't manage to hack my size ;)

Julien PELLET