PDA

View Full Version : Unable to create Group Grid Panel



tsrirama
13 Sep 2008, 4:05 AM
Unable to group the fields. Even the grid is not picking up the values returned by php file.
Referred few examples still unable to locate the mistake to get the desired output.

Ext.onReady(function()
{
var win;
Ext.QuickTips.init();

Ext.form.Field.prototype.msgTarget = 'side';
var button = Ext.get('ScoreCard');

button.on('click', function()
{

var reader = new Ext.data.ArrayReader({}, [
{name: 'client_Name'},
{name: 'PR_Number'},
{name: 'Alert_Date_Time'},
{name: 'Crt_Date_time'},
{name: 'Host_Name'},
{name: 'Description'},
{name: 'Last_mod_user'},
{name: 'Mod_Dtime'},

]);


var PRDetails = new Ext.data.Store({
//fields: ['name'],
method: 'GET',
proxy: new Ext.data.HttpProxy({url:'Scorecard.php'}),
reader: new Ext.data.JsonReader(
{
root:'sample'
},
[
//{name:'client_Name', type:'string', mapping: 'client_Name'},'PR_Number','Alert_Date_Time','Crt_Date_time','Host_Name','Description','Last_mod_user','Mod_Dtime'
'client_Name','PR_Number','Alert_Date_Time','Crt_Date_time','Host_Name','Description','Last_mod_user','Mod_Dtime'
])
});
PRDetails.load();



var simpleGrid = new Ext.grid.GridPanel
({
//store: PRDetails,

store: new Ext.data.GroupingStore({
reader: reader,
data: PRDetails,
sortInfo:{field: 'client_Name', direction: "ASC"},
groupField:'Last_mod_user'
}),


columns:
[
{id: 'client_Name', header: 'client_Name',width: 160, dataIndex: 'client_Name',sortable: true },
{header: 'PR#', dataIndex: 'PR_Number', sortable: true},
{header: 'Alert Date/Time',width: 160, dataIndex: 'Alert_Date_Time',sortable: true},
{header: 'PR Date/Time', width: 160, dataIndex: 'Crt_Date_time',sortable: true},
{header: 'Host Name', width: 160, dataIndex: 'Host_Name',sortable: true},
{header: 'Description', width: 160, dataIndex: 'Description',sortable: true},
{header: 'Reporter', width: 160, dataIndex: 'Last_mod_user',sortable: true},
{header: 'Reported Date/Time', width: 160, dataIndex: 'Mod_Dtime',sortable: true}
],

view: new Ext.grid.GroupingView({
forceFit:true,
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
}),
//frame: true,
collapsible: true,
sortable: true,
//stripeRows: true,
//autoHeight:true,
width:700,
height:450,
animCollapse: false,
title: 'Grouping Example',
iconCls: 'icon-grid',
renderTo: document.body
});


/*var simple = new Ext.FormPanel({
labelWidth: 150,
frame:true,
bodyStyle:'padding:5px 5px 0',
bodyStyle:'border:0px',
width: 350,
defaultType: 'textfield',
items:[simpleGrid]
});*/

if(!win)
{
win = new Ext.Window
({
layout:'fit',
title : 'Shift Hand-Over Report',
width:800,
height:535,
closeAction:'hide',
bodyStyle:'border:0px',
plain: true,
items:[simpleGrid]

});
}
win.show(this);
//Ext.getCmp('whateverID1').getStore().reload();
});
});

mjlecomte
13 Sep 2008, 5:23 AM
What is the difference between the "desired output" and the output you have now?

Do you load the store?

Oh, and why not indent your code in some legible format?

tsrirama
13 Sep 2008, 10:12 AM
- With slight modification I able the list the values in Grid (Without Grouping)
- When I try with grouping, Grid is unable to pick up the values & group accordingly.

mjlecomte
13 Sep 2008, 11:58 AM
Post your current, properly indented code.

tsrirama
15 Sep 2008, 7:01 PM
Any help please...

mjlecomte
16 Sep 2008, 3:36 AM
Post your current, properly indented code.

?