PDA

View Full Version : [FIXED] [4.2.beta] Grid view refresh and toggleSummaryRow not working as expected



vicvolk
2 Jan 2013, 11:55 PM
REQUIRED INFORMATION


Ext version tested:
Ext 4.2.beta


Browser versions tested against:
Opera, FF


DOCTYPE tested against:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


Description:
I use toggleSummaryRow in order to hide summary row for the first time and use view.refresh inside a handler in order to show summary row. This functionality works perfectly in 4.0.0, but not in 4.2.beta


Steps to reproduce the problem:
Run the code below


Test Case:



<?php
$old = "extjs4/ext-4.0.0";
$new = "ext42";
$fld = $new; // if we target to 4.0.0, everything is correct
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../include/js/<?=$fld?>/bootstrap.js"></script>
<link rel="stylesheet" type="text/css" href="../include/js/<?=$fld?>/resources/css/ext-all.css" />
<script type="text/javascript">

Ext.require([
'Ext.grid.*',
'Ext.data.*',
'Ext.form.field.Number'
]);

Ext.define('Company', {
extend: 'Ext.data.Model',
fields: [
{name: 'price', type: 'float'}
],
idProperty: 'company'
});

Ext.onReady(function() {

var myData = [
[71.72],
[29.01],
[83.81]
];

var store = Ext.create('Ext.data.ArrayStore', {
model: 'Company',
data: myData
});

var showSummary = false;

var grid = Ext.create('Ext.grid.Panel', {
store: store,
id:'grid',
hideCollapseTool: true,
stateful: true,
columnLines: true,
layout:'fit',
border:false,
features: [{
id: 'sumline',
ftype: 'summary'
}],
dockedItems: [ {
xtype: 'toolbar',
items: [{
tooltip:'??????????? ??????',
text: 'Summary',
handler: function(){

var view = grid.getView();
showSummary = !showSummary;
view.getFeature('sumline').toggleSummaryRow(showSummary);
view.refresh();

}
}]
}],
columns: [
{
text : 'Price',
width : 75,
sortable : true,
dataIndex: 'price',
summaryType: 'sum',
field: {
xtype: 'numberfield'
}
}
],
viewConfig: {
stripeRows: false,
enableTextSelection: true
}
});

Ext.getCmp('grid').view.getFeature('sumline').toggleSummaryRow(false);

var viewport = new Ext.Viewport({
layout: {
type: 'border'
},
collapsible: true,
defaults: {
collapsible: true,
split : true
},
items: [
{
title : '',
region : 'center',
collapsible: false,
id: 'main',
layout:'fit',
items: [grid]
}
]
});

});

</script>
</head>
<body>
</body>
</html>


Additional CSS used:
only default ext-all.css


Operating System:
Win7

mitchellsimoens
3 Jan 2013, 7:47 AM
Thanks for the report! I have opened a bug in our bug tracker.