By default all items loaded from server or created with script are shown at once. But to increasing loading speed and make perception better you can use paginal output. With paginal output only limited number of items are visible. Other items can be viewed by switching to other page(s).
To turn on paginal output use the following way:
myFolders.enablePaging(10,true);
Where the first argument is a number of items per page, the second one allows dhtmlxFolders to request additional content from the server when no items are available to fill complete page (more details about dynamical loading see below).
To reset new number of items per page use enablePaging again with new number items per page. Each time you change number of items per page, dhtmlxFolders switches to the 1st page.
To turn paging off use:
myFolders.enablePaging(false);
Using the second argument of enablePaging method you can allow (true) or deny (false) dhtmlxFolders to apply for additional content to server. In case it is allowed, dhtmxFolders will send request to server using same URL which was specified in loadXML method but with additional parameter:
dhx_global_page parameter will increment its value by 1 with each next request starting from the very first one (so, the first automatic request will have dhx_global_page=2)
Important: if you are going to use paging with dynamical loading please make sure you included processing of dhx_global_page into your xml producing routine. Otherwise dhtmlxFolders will get same content endless times.
The first version (1.0) of dhtmlxFolders doesn't provide ready to use interface objects for managing paging, but it does provide API methods for building it. The main method for it is: goToPage(pgNum). It provides the possibility to navigate through pages. If no page number passed, then it will return to the first page.
On each call, goToPage returns value, which means the following:
The same values are returned by enablePaging method.
Version 1.1 of dhtmlxFolders includes some universal solution. Only one thing you need to decide - where to put pages. You can specify the object on page which will be parent element for pages using setPagerContainer(object ID or object).
Other methods which can be useful while working with paging: