PDA

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



fancing
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?

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

fancing
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);


limit



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"?>
<schemas>
<total>6</total>
<schema>
<id>1</id>
<name>abbb</name>
<image>rudimental.gif</image>
<price>〖¥780+〗</price>
<date>2007-09-27</date>
<link>rudimental.html</link>
<description>
bbbbbbbbbbbb
</description>
</schema>
<!-- the other 5 schema -->
</schemas>

fancing
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!

tryanDLS
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.

t.safeer
21 May 2008, 11:33 PM
Hi

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

Thanks in advance