can't group in grid extjs 3.4

916 Views Asked by At

I have made a webapp with extjs 3.4. I have a grid that I want to group with field street but I can't. My code is here:

var store_intervencoes =  new Ext.data.GroupingStore({
                reader: new Ext.data.JsonReader({
                root:'rows',
                autoLoad: false,
                type : 'ajax',
                //remoteGroup: false,
                groupField: 'street',
                fields:[{ name:'street', type:'integer'},
                    { name:'intervenction', type:'string'},
                    { name:'priority', type:'integer'},
                    { name:'value', type:'string'}]
                })
        }); 


var gridPanel = new Ext.grid.GridPanel({
            header: false,
            store: store_intervencoes,
            selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
            layout: 'fit',
            height: 300,
            width: 1000,
            columnLines: true, 
            cls: 'grid_intervencoes',
            autoScroll: true,
            stripeRows: true,
            autoFill : true,                        
            viewConfig: { emptyText: 'nothing', deferEmptyText: false },
            groupField: 'street',
            view: new Ext.grid.GroupingView({
                        forceFit:true,
                        autoHeight: true,
                        autoFill : true,
                        groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "fk_n_rua"]})'
                                        }),
            columns: [{
                //header: "Nome",
                //sortable: true,
                dataIndex: "intervenction",
                //width: 450
                },{
                //header: "Prioridade",
                //sortable: true,
                dataIndex: "priority",
                //width: 50
                },{
                //header: "Custo" + ' \u20AC',
                //sortable: true,
                dataIndex: "value",
                //width: 50
                },{
                //header: 'Trecho',
                //sortable: true,
                dataIndex: "street",
                //width: 50,
                //groupable: true
                }],
                collapsible: true,
                animCollapse: false,
                title: 'Grouping Example',
                iconCls: 'icon-grid',
                fbar  : [{
                    xtype: 'numberfield',
                    id: 'total',
                    name: 'total',
                    fieldLabel: 'Total',
                    value: '0',
                    readOnly: true,
                    fieldCls: 'valores'
                }]
            });

I think I have all the code like this example: http://dev.sencha.com/deploy/ext-3.4.0/examples/grid/grouping.html

I don't know why the grid doesn't group. I get all the data from a database with ajax and php that generate json. All fields shows up. The unique problem is the non grouping. I also get no errors.

Anyone could help me with that?

0

There are 0 best solutions below