PDA

View Full Version : Problem for sorting grid



4 Jul 2010, 1:02 AM
Hi,

I made a very simply grid but i have a problem. I can click on the grid's header, normaly this action sort the grid but by nothing is doing :(

My second problem is that the grouping field dont work too

my code:



Ext.onReady(function(){


// ----------------
// Datastore
// ----------------

functionProxy= new Ext.data.HttpProxy({

url:'http://localhost/~vuilled/HFRHR/index.php/DashboardWelcome/welcome',
method:'POST'

});


functionReader=new Ext.data.JsonReader({
root:'results',
totalProperty:'total',
id:'FunctionReader',
},
[
{name: 'Numero', type: 'int', mapping: 'FonctionBaseEta'},
{name: 'Description', type: 'string', mapping: 'FonctionBaseEtaLE'},

]);



functiondataStore=new Ext.data.GroupingStore({
id:'functiondataStore',
proxy:functionProxy,
reader:functionReader,
sortInfo:{field: 'Numero', direction: "ASC"},
groupField: 'Description'





});

view: new Ext.grid.GroupingView({
forceFit: true,
// custom grouping text template to display the number of items per group
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
}),



// ----------------
// ColumnModel
// ----------------


FunctionColumnModel = new Ext.grid.ColumnModel({
columns: [{
header: '#',
dataIndex: 'Numero',
readOnly: true
},{
header: 'Description',
dataIndex: 'Description',
readOnly: true

}],
defaults: {
sortable: true
},


});



EmployeView = new Ext.grid.GroupingView({
forceFit:true,
// custom grouping text template to display the number of items per group
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
});

// ----------------
// Grid
// ----------------
var grid = new Ext.grid.GridPanel({
height:400,
renderTo: 'grid-example',
store: functiondataStore,
id: 'grid',
width: 740,
viewConfig: {
forceFit: true
},
cm: FunctionColumnModel
});


functiondataStore.load();



});


thanks for your responses