PDA

View Full Version : Problem with grouping feature in grid when collapse/expand group header



earist
30 Mar 2015, 11:06 PM
Hi all,

I am using ExtJS4.2 version.
I have implemented a lockable grid with grouping feature.

In my Model, there is a field that is a temporary field.
This field is used to be a group field.
For example:


Ext.define('Company', {
extend: 'Ext.data.Model',
fields: [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'},
{name: 'country'},
{name: 'zone', mapping : 'country', convert : function(v, rec){
// I would like to map this field with 'country'. However "v" is always empty. So. I try to get the country value from record instead.
var v = rec.data.country;
if (v == "Japan" || v == "Thailand" || v == "Singapore")
return "Asia";
else if (v == "England")
return "Europe";
else if (v == "USA")
return "USA";
else
return "Other";
}}
],
idProperty: 'company'
});


When I run the code, it show result correctly:
52073

However, when I try to collapse a group such as "Zone: Asia", it show invalid result.
Following picture is the result after I collapsed the group:
52074

The records in "Zone: Asia" and group header are missing.
Please see the code in jsfiddle (http://jsfiddle.net/earist/43nmt6me/) for more details.

How can I fix this problem?

Thanks in advance
earist

Gary Schlosberg
6 Apr 2015, 8:30 AM
I wasn't able to run the code using that link, but I added your code to this Fiddle and it seems to work.
https://fiddle.sencha.com/#fiddle/kri

Do you see the same results?

earist
7 Apr 2015, 9:23 PM
Sorry for late reply and thanks for your help, Gary Schlosberg.
The issue will occur when I use Ext JS 4.2.0.663 Framework.

earist.

Gary Schlosberg
8 Apr 2015, 3:26 PM
OK, I see the issue now. The good news is that it's fixed in 4.2.1.

earist
9 Apr 2015, 9:17 AM
Hi Gary Schlosberg,

Could you please tell me on how to fix this issue in Ext JS 4.2.0
I cannot upgrade the framework (according to our product plan)

Thanks
earist