PDA

View Full Version : Destroying windows



slemmon
21 Jan 2012, 6:58 PM
Can someone check to see if this is just an oversight on my part?
I am defining a grid and a window containing that grid in an accordion layout.

Then I've set up a viewport with an instance of the previously defined grid in an accordion layout and a toolbar button that creates an instance of the previously defined window.

I'm getting issues in 4.0.7 with the the window not popping up a second time and also with double-headers in the window version of the grid. And in 4.0.7 and 4.1 I'm not able to open the window more than once and opening it once fouls up the grid in the viewport.

This is on FF5 and IE8 in strict mode.

JSFiddle: http://jsfiddle.net/slemmon/KZAYj/


Ext.onReady(function () {
Ext.define('myGrid', {
extend: 'Ext.grid.Panel'
, alias: 'widget.mygrid'

, title: 'My Grid'
, columns: [{
text: 'One'
, dataIndex: 'one'
}, {
text: 'Two'
, dataIndex: 'two'
}]
, store: {
fields: ['one', 'two']
, data: [{
one: 'value'
, two: 'value'
}]
}
});

Ext.define('myWindow', {
extend: 'Ext.window.Window'
, alias: 'widget.mywindow'

, title: 'My Grid Window'
, width: 400
, height: 300
, autoShow: true
, modal: true
, layout: 'accordion'
, items: [{
xtype: 'panel'
, title: 'First Panel'
}, {
xtype: 'mygrid'
, dockedItems: [{
xtype: 'toolbar'
, dock: 'top'
, items: [{
text: 'Sample Button'
}]
}]
}]
})

Ext.widget('viewport', {
layout: 'accordion'
, items: [{
xtype: 'panel'
, title: 'Accordion Panel'
, dockedItems: [{
xtype: 'toolbar'
, dock: 'top'
, items: [{
text: 'Create Window'
, handler: function () {
Ext.widget('mywindow');
}
}]
}]
}, {
xtype: 'tabpanel'
, title: 'Accordion 2'
, items: [{
xtype: 'mygrid'
}]
}]
});

}); // end of onReady()

slemmon
21 Jan 2012, 7:28 PM
Having a toolbar in the custom grid definition seems to cause the header issues.

Screenshot from 4.0.7 (can be seen in JSFiddle by opening/closing the window / accordion panels a few times).

30885

Animal
22 Jan 2012, 2:17 AM
I'll take a look at this.

slemmon
22 Jan 2012, 10:30 AM
Excellent. Thank you.

The way I got around it in my project for the time being was to wrap my grids in a panel and add the toolbar to the wrapping panel instead of the grid. Not ideal, but worked to move me forward in the interim.