Dear All ,
I have a problem with my grid. I have a grid that contains Grouping and at
the same time paging . My problem is that my datas are not displayed
correctly . I have datas that display as Top 20 countries in each month . ie
for january,top20 countries will dispaly,for february top 20 countries will
display like that . Datas are displaying ,But problem is while displaying
for eg,for january it will display first six countries( 1 to 6 ),then in
next page again january 7 to 12 Countries ,then next page 13 to 19 countries
then in fourth page remaining 20th country . Like that for every month .
What i need to display is first top 20 countries for january,Then Top 20
countries for february etc.
For eg, Datas in the first page.see feb 2009
Order : Country
Feb 2009
1 : usa
2 : china
3 : Britain
4 : france
5 : italy
6 : russia
March 2009
1:
2:
3:
...........
Aug 2009
........
Datas in the second page
March 2009
1:
2:
3:
4:
5
Feb 2009
7: denmark
8:Hongkong
9:japan
10:india
11:australia
Datas in third page
12: new-zealand
13: south africa
14: brazil
15: ....
Below is my code for the grid.
RecordDef recordDef = new RecordDef(createfieldDefs());
final GroupingStore store = new GroupingStore(new
GWTProxyImpl(), new ArrayReader(recordDef), true);
//store.setBaseParams(new UrlParam[]{new UrlParam("paramName",
"paramValue")});
store.setSortInfo(new SortState("order_num", SortDir.ASC));
store.setGroupField("up_to");
GroupingView gridView = new GroupingView();
gridView.setForceFit(true);
gridView.setGroupTextTpl("{text} ({[values.rs.length]}
{[values.rs.length > 1 ? \"Items\" : \"Item\"]})");
GridPanel grid = new GridPanel(store, createColModel());
grid.setView(gridView);
grid.setWidth(650);
grid.setHeight(600);
grid.setLoadMask(true);
grid.stripeRows(true);
grid.setCollapsible(true);
grid.setAnimCollapse(false);
grid.setTitle("Report Title");
final PagingToolbar pagingToolbar = new PagingToolbar(store);
pagingToolbar.setPageSize(60);
pagingToolbar.setDisplayInfo(true);
pagingToolbar.setDisplayMsg("Displaying records {0} - {1} of
{2}");
pagingToolbar.setEmptyMsg("No records to display");
NumberField pageSizeField = new NumberField();
pageSizeField.setWidth(40);
pageSizeField.setSelectOnFocus(true);
pageSizeField.addListener(new FieldListenerAdapter() {
public void onSpecialKey(Field field, EventObject e) {
if (e.getKey() == EventObject.ENTER) {
int pageSize =
Integer.parseInt(field.getValueAsString());
pagingToolbar.setPageSize(pageSize);
}
}
});
if(urlParameters.size() > 0)
{
UrlParam[] u = new UrlParam[urlParameters.size()];
for(int i=0;i<urlParameters.size();i++)
u[i]=urlParameters.get(i);
store.setBaseParams(u);
}
ToolTip toolTip = new ToolTip("Enter page size");
toolTip.applyTo(pageSizeField);
pagingToolbar.addField(pageSizeField);
Toolbar topToolbar = new Toolbar();
topToolbar.addSeparator();
topToolbar.addFill();
// topToolbar.addText("From Date:");
// topToolbar.addText("To Date:");
grid.setTopToolbar(topToolbar);
grid.setBottomToolbar(pagingToolbar);
store.load(0, pagingToolbar.getPageSize());
grid.getView().setAutoFill(true);
grid.getView().setForceFit(true);
panel.add(grid);
Your help will be appreciated .
Thanks,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---