PDA

View Full Version : Grouping dynamic Grid does not work.



dhukke
20 May 2014, 4:44 PM
Hey guys.

I'm working on an Ext MVC project and I want to load a grid dynamically. Actually I already did this part, I created a grid and used reconfigure (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.Panel-method-reconfigure) to load the data dynamically passing the store (the store and the model are created on the fly) and the columns.

When I group my grid I do it by a field in my model that represents the merge of other two fields (to simulate a multi grouping, got the idea here (http://www.mysamplecode.com/2012/04/extjs-grid-grouping-summary-example.html)), and when I run this I got an error message saying that the it is impossible to find the length of undefined (the undefined is the 'rows' that you can find bellow in the code) and I'm not able to collapse the group header.

Here is an example of the model:



Ext.define('MyApp.model.Test', {
extend: 'Ext.data.Model',
fields: [
'id',
'test',
'2_test',
'3_test',
{
name: 'myGroup',
mapping: '2_test',
convert: function(v, record) {
return v + ': ' + record.data.3_test;
}
}
]});


And here is the part of the code where the error is ('rows' undefined):



features: [ Ext.create('Ext.grid.feature.GroupingSummary', {
id: 'groupSummary',
groupHeaderTpl: '{name} ({rows.length} {[values.rows.length > 1 ? "Items" : "Item"]})' }) ]


I'm doing something wrong? Can anyone help me?

Gary Schlosberg
9 Jun 2014, 7:40 AM
In which version of ExtJS are you seeing this issue? That post is a few years old, so if you are using a recent version of ExtJS, you might contact the author to see if the issue is know and if there is a workaround.