Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jan Helbig on Dec 15, 2008 12:14
open dhtmlx forum
grid + paging + smart rendering

We use professionell version of grid with paging and smart rendering with xml loading.

first request:
url = someUrl

responding xml:
<?xml version="1.0" encoding="UTF-8"?>
<rows total_count="65" pos="0">
some header
10 rows
</rows>

-> first page will be correct displayed

klick to second page:
url = someUrl?posStart=10&count=10

responding xml:
<?xml version="1.0" encoding="UTF-8"?>
<rows total_count="65" pos="10">
some header
next 10 rows
</rows>

-> paging goes back to page one and shows: datasets 1 to 0 from 65

what is wrong?
Answer posted by Support on Dec 16, 2008 01:49
When XML contains header section ("<head>..</head>") , grid fully reset its configuration based on data from header, which result in not-expected behavior in your case. 
Just user pure data, without head section for loading additional paging data 

url = someUrl?posStart=10&count=10 
responding xml: 
<?xml version="1.0" encoding="UTF-8"?> 
<rows total_count="65" pos="10"> 
next 10 rows 
</rows>

By the way, you need total_count attribute for first xml only, can be skiped for next loadings

Answer posted by Jan Helbig on Dec 16, 2008 07:25
Ok, this works now.

In this environment we will enabling server side filtering.

I use following code:

            grid.attachEvent("onFilterStart", function (colIds, values) {              
                grid.clearAll();
                var filterUrl = ...;     
                grid.loadXML(filterUrl, function () {
                });
               
                return false;
            });

the filtering works, but filter values are removed from filter fields in header

Can i prevent this?
Answer posted by Support on Dec 16, 2008 08:23
the issue can occur when

a) you still contain "head" section in XML loaded after filter applied. ( in such case grid will be reset, which will result in header recreation and lost of previous filters as result ) 

b) if you are using #select_filter, grid will try to reload them from new data loaded, which may result in lost of previously selected value. 
You can try to modify your code as

 grid.attachEvent("onFilterStart", function (colIds, values) {  
  grid.refreshFilters=function(){} //will block filter list refreshing functionality
  grid.clearAll();
  var filterUrl = ...;  
  grid.loadXML(filterUrl, function () {
  });
   
  return false;
  });