A component loads all data at once by default, but it's possible to configure the component so that data will be loaded on demand (this mode can be used with paging to organize dynamic paging, or without it )
Dynamic loading can be organized with XML and JSON data sources only.
The initial response from server must contain the total_count parameter at the top level. It will contain the info about the expected count of items in the dataview.
Each next request must contain the pos value with the info about index of the first record in the set.
For XML:
<data total_count="5000" pos="0">
<item id="1">
<Package><![CDATA[acx100-source]]></Package>
<Version><![CDATA[20080210-1.1]]></Version>
</item>
<item id="2">
<Package><![CDATA[alien-arena-browser]]></Package>
<Version><![CDATA[7.0-1]]></Version>
</item>
...
</data>
For JSON:
{
{"total_count":"5000","pos":"0", data:[
{
"id":"1",
"Package":"acx100-source",
"Version":"20080210-1.1",
},{
"id":"2",
"Package":"alien-arena-browser",
"Version":"7.0-1"
}
...
]}
}
There is no need for extra commands on the client side, as the presence of the "total_count" parameter will be enough for triggering dynamic loading.
You can define a separate template which will be used for the items which are not loaded yet.
view = new dhtmlXDataView({
container:"data_container",
type:{
template:"#Package# : #Version#<br/>#Maintainer#",
template_loading:"Loading..."
}
});
Related sample: Dynamic loading
Back to top