PDA

View Full Version : Close a window on selecting a row in grid panel



sarabjeetd
2 May 2012, 1:18 PM
I have a Ext.window.Window which has a grid panel. When I select a row in the panel, i want to close the window. I tried calling close on the window but it does not do anything.

I am using Ext.js Version Number: 4.1.0 Beta 2a-Sarab

Tim Toady
2 May 2012, 1:23 PM
Can you share the relevant code? window.close() should close a window.

debabrata
2 May 2012, 9:01 PM
In 'select' event try to access your window and close it. :)

Tim Toady
3 May 2012, 5:35 AM
Works for me on 4.1 final. I would use itemclick though.


Ext.create( 'Ext.window.Window', {
layout: 'fit',
items: [
{
xtype: 'grid',
store: Ext.create( 'Ext.data.Store', {
fields: [
'1'
],
data: {
'1': 'asd'
}
} ),
columns: [
{
header: 'col1',
dataIndex: '1'
}
],
listeners: {
itemclick: function() {
this.up( 'window' ).close();
}
}
}
]
} ).show();