PDA

View Full Version : Bag in grouped-header-grid



jumpow
30 Jul 2013, 8:44 PM
When group header becomes hidden, then showed, subheaders still hidden<br>
<br>
There is grid<br>
<a href="http://www.sencha.com/forum/attachment.php?attachmentid=45110&amp;d=1375179211" target="_blank"><img src="http://www.sencha.com/forum/attachment.php?attachmentid=45110&amp;d=1375179211&amp;thumb=1" alt="" border="0"></a><br>
<br>
Hide one group<br>
<a href="http://www.sencha.com/forum/attachment.php?attachmentid=45111&amp;d=1375179211" target="_blank"><img src="http://www.sencha.com/forum/attachment.php?attachmentid=45111&amp;d=1375179211&amp;thumb=1" alt="" border="0"></a><br>
<br>
Now try return columns <br>
<a href="http://www.sencha.com/forum/attachment.php?attachmentid=45112&amp;d=1375179212" target="_blank"><img src="http://www.sencha.com/forum/attachment.php?attachmentid=45112&amp;d=1375179212&amp;thumb=1" alt="" border="0"></a><br>
<br>
Subheaders are hidden...<br>
<a href="http://www.sencha.com/forum/attachment.php?attachmentid=45109&amp;d=1375179210" target="_blank"><img src="http://www.sencha.com/forum/attachment.php?attachmentid=45109&amp;d=1375179210&amp;thumb=1" alt="" border="0"></a><br>
<br>
Tested in FireFox 19, IE8<br>
Windows: XP<br>
<br>
Source code:<br>
<span style="font-family: courier new">&lt;!DOCTYPE HTML&gt;<br>
&lt;html&gt;<br>
&lt;head&gt;<br>
&lt;meta http-equiv='Content-Type' content='text/html; charset=utf-8' /&gt;<br>
&lt;link rel='stylesheet' type='text/css' href='extjs/resources/css/ext-all.css'&gt;<br>
&lt;script type='text/javascript' src='extjs/ext-all-debug.js'&gt;&lt;/script&gt;<br>
<br>
&lt;script type="text/javascript"&gt;<br>
function getProc(value, total)<br>
{ <br>
if(total == 0)<br>
return '-';<br>
var part = Math.round(value*1000/total);<br>
var text = '' + Math.floor(part/10);<br>
text += '.';<br>
text += part%10;<br>
text += '%';<br>
return text; <br>
} <br>
<br>
Ext.application(<br>
{<br>
name: 'Statistic',<br>
launch: function() <br>
{<br>
Ext.BLANK_IMAGE_URL='extjs/resources/s.gif';<br>
var repData = <br>
[<br>
[1111,1200, 2311],<br>
[111, 120, 231],<br>
[999, 1020, 2019],<br>
[ 1, 60, 61]<br>
];<br>
var store = Ext.create('Ext.data.ArrayStore', <br>
{<br>
fields: <br>
[<br>
{name: 'Day1', type: 'int'},<br>
{name: 'Day2', type: 'int'},<br>
{name: 'Total', type: 'int'}<br>
],<br>
data: repData<br>
});<br>
var grid = Ext.create('Ext.grid.Panel', <br>
{<br>
xtype: 'grouped-header-grid',<br>
columnLines: true,<br>
store: store,<br>
stateful: true,<br>
stateId: 'stateGrid',<br>
autoScroll:true,<br>
columns: <br>
[<br>
{<br>
text: 'Day 1', <br>
columns:<br>
[<br>
{<br>
text: 'Count',<br>
width : 75,<br>
sortable : false,<br>
dataIndex: 'Day1'<br>
},<br>
{<br>
text : '%',<br>
width : 75,<br>
sortable : false,<br>
renderer : function(value, metaData, record, rowIdx, colIdx, store, view)<br>
{ <br>
return getProc(record.get('Day1'), record.get('Total'));<br>
}<br>
}<br>
] <br>
},<br>
{<br>
text: 'Day 2', <br>
columns:<br>
[<br>
{<br>
text: 'Count',<br>
width : 75,<br>
sortable : false,<br>
dataIndex: 'Day2'<br>
},<br>
{<br>
text : '%',<br>
width : 75,<br>
sortable : false,<br>
renderer : function(value, metaData, record, rowIdx, colIdx, store, view)<br>
{ <br>
return getProc(record.get('Day2'), record.get('Total'));<br>
}<br>
}<br>
]<br>
}<br>
],<br>
height: 200,<br>
width: 350,<br>
viewConfig: <br>
{<br>
stripeRows: true<br>
}<br>
});<br>
var portal = new Ext.Viewport(<br>
{<br>
layout: 'border',<br>
autoScroll:true,<br>
renderTo: 'SJAggReport',<br>
fit:1,<br>
items: <br>
[<br>
{<br>
id: 'JSCenter',<br>
region: 'center', <br>
layout: 'vbox',<br>
margins: '2 2 0 0',<br>
items:<br>
[<br>
grid<br>
]<br>
} <br>
]<br>
});<br>
}<br>
});<br>
&lt;/script&gt;<br>
&lt;/head&gt;<br>
&lt;body&gt;<br>
&lt;DIV id='SJAggReport'&gt;&lt;/DIV&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;</span>

jumpow
30 Jul 2013, 8:51 PM
Occasionally post twice. How to remove?