PDA

View Full Version : [2.0??] GridPanel



yogeshmsharma
28 Nov 2007, 1:09 AM
Hi Everyone,
I am new to ExtJs and I am facing some issue with Grid Panel.
I want paging control in my grid , I referred the paging.js but by data is their in array but I need to provide paging navigation.
Here is my simple code


// the DefaultColumnModel expects this blob to define columns. It can be extended to provide
// custom or reusable ColumnModels
var colModel = new Ext.grid.ColumnModel([
{id:'company',header: "Company", width: 160, sortable: true, locked:false, dataIndex: 'company'},
{header: "Price", width: 75, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
{header: "Change", width: 75, sortable: true, renderer: change, dataIndex: 'change'},
{header: "% Change", width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'},
{header: "Last Updated", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
]);


// create the Grid
var groupStore = new Ext.data.GroupingStore({
reader: rd,
data: myData,
sortInfo:{field: 'company', direction: "ASC"},
groupField:'company'
});
var dk = [['11111111111 Co',71.72,0.02,0.03,'9/1 12:00am'],
['2222222222 Co',71.72,0.02,0.03,'9/1 12:00am']]

groupStore.loadData(dk,true);
var grid = new Ext.grid.GridPanel({
el: 'grid-example',
ds:groupStore,
cm: colModel,
autoExpandColumn: 'company',

title:'Array Grid',
view: new Ext.grid.GroupingView({
forceFit:false,
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
}),
bbar: new Ext.PagingToolbar({
pageSize: 5,
store: groupStore,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display",

}),
frame:true,
width: 700,
height: 250,
collapsible: true,
animCollapse: true,
title: 'Grouping Example',
iconCls: 'icon-grid',

});

grid.render();

mystix
28 Nov 2007, 3:33 AM
Hi Everyone,
I want paging control in my grid , I referred the paging.js but by data is their in array but I need to provide paging navigation.

please provide a clearer explanation.

p.s. please post other details as per 13985. thanks.

tryanDLS
28 Nov 2007, 8:15 AM
This certainly doesn't appear to be a Bug - moved to Help.