View Full Version : Is it possible to implement pagination when using XmlReader?

9 Oct 2007, 7:44 PM
i have a xml file holding some data, but many records, i want to put them into grid and paginate them.
is it possible to do this via XmlReader?
or i have to dynamically output xml?

9 Oct 2007, 7:47 PM
Your server logic would have to return an xml doc for each page.

9 Oct 2007, 8:19 PM
i have set the totalRecords and limit the page size.

var xmlReader = new Ext.data.XmlReader({
totalRecords: "total", // The element which contains the total dataset size (optional)
record: "schema", // The repeated element which contains row information
id: "id" // The element within the row that provides an ID for the record (optional)
}, SchemaDef);


var PAGESIZE = 3;
var gridFoot = grid.getView().getFooterPanel(true);
// add a paging toolbar to the grid's footer
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: PAGESIZE,
displayInfo: true,
displayMsg: '当前显示: {0}-{1} / {2}',
emptyMsg: "没有记录可显示"

the xml carries 6 total data, some code segment like this:

<?xml version="1.0" encoding="UTF-8"?>
<!-- the other 5 schema -->

9 Oct 2007, 8:22 PM
Your server logic would have to return an xml doc for each page.

That means the data store cannot reuse the data!?
Anyway, Thanks for reply!

10 Oct 2007, 9:14 AM
As I said, the paging is server side. The point of paging is to avoid returning and parsing a huge xml document on the client. There are examples of paging a client side collection for cases when you really need that functionality and performance isn't an issue - so you could load the entire document into a JS collection and page it - look in the Examples forum.

21 May 2008, 11:33 PM

I am also facing the same problem. Can you pls explain how to do it in server side.

Thanks in advance