PDA

View Full Version : [FIXED-433][3.1.1-beta] Grid cannot be re-grouped once clearGrouping() is called



paulcrowder
15 Jan 2010, 11:12 AM
Ext version tested:


Ext 3.1.0



Adapter used:


ext



css used:


only default ext-all.css



Browser versions tested against:


IE8
FF3
Chrome 3



Operating System:


WinXP Pro



Description:


Once the clearGrouping() method is called on a grid's GroupingStore, the grid can no longer be grouped again by calling its GroupingStore's groupBy() method. With Ext 3.0.3, calling groupBy() would re-group the store properly.



Test Case:



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Grid Test</title>

<!-- ** CSS ** -->
<!-- base library -->
<link type="text/css" rel="stylesheet" href="extjs/ext-3.1.0/resources/css/ext-all.css" />

<!-- ** Javascript ** -->
<!-- base library -->
<script type="text/javascript" src="extjs/ext-3.1.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-3.1.0/ext-all-debug.js"></script>

<!-- page specific -->
<script type="text/javascript">
Ext.onReady(function () {

Ext.BLANK_IMAGE_URL = "extjs/ext-3.1.0/resources/images/default/s.gif";

// sample static data for the store
var myData = [
{company:'3m Co',price:71.72,change:0.02,pctChange:0.03,lastChange:'9/1 12:00am'},
{company:'3m Co',price:71.72,change:0.02,pctChange:0.03,lastChange:'9/1 12:00am'},
{company:'3m Co',price:71.72,change:0.02,pctChange:0.03,lastChange:'9/1 12:00am'},
{company:'3m Co',price:71.72,change:0.02,pctChange:0.03,lastChange:'9/1 12:00am'},
{company:'Alcoa Inc',price:29.01,change:0.42,pctChange:1.47,lastChange:'9/1 12:00am'},
{company:'Alcoa Inc',price:29.01,change:0.42,pctChange:1.47,lastChange:'9/1 12:00am'},
{company:'Altria Group Inc',price:83.81,change:0.28,pctChange:0.34,lastChange:'9/1 12:00am'},
{company:'Altria Group Inc',price:83.81,change:0.28,pctChange:0.34,lastChange:'9/1 12:00am'},
{company:'Altria Group Inc',price:83.81,change:0.28,pctChange:0.34,lastChange:'9/1 12:00am'}
];

// create the data store
var store = new Ext.data.GroupingStore({
fields: [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
],
reader: new Ext.data.JsonReader({
fields: [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
]
}),
groupField: "company",
sortInfo: {
field: "company",
direction: "ASC"
}
});

// manually load local data
store.loadData(myData);

var sm = new Ext.grid.RowSelectionModel({
singleSelect: false
});

var groupingView = new Ext.grid.GroupingView({
});

// create the Grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{id:'company',header: 'Company', width: 160, sortable: true, dataIndex: 'company'},
{header: 'Price', width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'},
{header: 'Change', width: 75, sortable: true, dataIndex: 'change'},
{header: '% Change', width: 75, sortable: true, dataIndex: 'pctChange'},
{header: 'Last Updated', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
],
height: 350,
width: 600,
clicksToEdit: 1,
enableColumnHide: false,
enableColumnMove: false,
enableHdMenu: false,
sm: sm,
view: groupingView
});

// render the grid to the specified div in the page
grid.render('grid-example');

Ext.EventManager.on("clear-group-button", "click", function () {
store.clearGrouping();
});

Ext.EventManager.on("group-button", "click", function () {
store.groupBy("company");
});
});
</script>
</head>
<body>
<div id="grid-example"></div>
<button id="clear-group-button">Clear grouping</button>
<button id="group-button">Group by company</button>
</body>
</html>


Steps to reproduce the problem:


Run the above sample. Note that the grid is grouped on the Company column.
Click the "Clear grouping" button which calls the store's clearGrouping() method. This will cause the grid to no longer be grouped.
Click the "Group by company" button.



The result that was expected:


The grid should now be grouped by the Company column.



The result that occurs instead:


The grid remains ungrouped.



Debugging already done:


Tested on 3.0.3 and it works as expected, so the issue was introduced in 3.1.0.



Possible fix:


not provided

hendricd
16 Jan 2010, 7:26 AM
Fixed in SVN 5900 for Ext 3.1.1.