PDA

View Full Version : paging with grouping store grid



coooolmagic
13 Jul 2010, 1:25 AM
hi all

i have a grid configured to use Grouping Store.
I want to implement paging with this.

I am displaying All Documents of several folders Grouped by their folder name.
So as Group Heading a folder Name appears and documents under it.

I am having problem in defining paging for this. This code is not working properly.

please suggest if you can. thanks in advance.

I want to implement paging so that i only see 20 folders name in one page.



Ext.onReady(function(){

Ext.QuickTips.init();

//alert(dataary);

var xg = Ext.grid; // Grid

//Grid Data Reader
var reader = new Ext.data.ArrayReader({}, [
{name: 'document_name'},
{name: 'folder_path'}
]);

//Grid Store
var store = new Ext.data.GroupingStore({
reader: reader,
autoLoad: true,
url: 'http://localhost:9080/servlet/getallfolderdocs',
sortInfo:{field: 'document_name', direction: "ASC"},
groupField:'folder_path'
});


var grid = new xg.GridPanel({
store: store,
frame:true,
height: 620,
layout:'fit',
collapsible: true,
animCollapse: true,
title: 'Folder Documents',
iconCls: 'icon-grid',

columns: [
{id:'document_name',header: "Document Name", width: 60, sortable: true, dataIndex: 'document_name'},
{header: "Folder Path", width: 20, sortable: true, dataIndex: 'folder_path'}
],

view: new Ext.grid.GroupingView({
forceFit:true,
startCollapsed:true,
groupTextTpl: '{group} ({[values.rs.length]} {[values.rs.length > 1 ? "Documents" : "items"]})'
}),


bbar: new Ext.PagingToolbar({
pageSize: 25,
store: store,
displayInfo: true,
displayMsg: 'Displaying Documents {0} - {1} of {2}',
emptyMsg: "No documents to display"
}),
renderTo: document.body
});

13 Jul 2010, 4:24 AM
I don't see a total count property in your store.

coooolmagic
19 Jul 2010, 12:43 AM
Store will have dynamic number of records all the time. so i am not sure in that case how i will set total count?
also how do i set total count?

Condor
19 Jul 2010, 12:55 AM
Paging works on records, not on groups. You would have to implement your own paging logic to do this.

coooolmagic
19 Jul 2010, 1:28 AM
I think I need some serious help and suggestion then.

I have a simple requirment and not able to decide what to use:

WE need to display approx 20000 records at any given point of time grouped based on a company name. This data will come from a dynamic servlet.

Can you please suggest me what is the best solution in grid? please give me little idea. I will heighly appreciate this help