PDA

View Full Version : Refresh a grid in a docked item?



lcarbonaro
20 Mar 2014, 12:03 PM
Hi.

I have a view (extends grid.Panel) which has a docked item. This docked item contains another grid. I need to update/refresh/reload the docked item grid as a result of a cellclick event in the first grid.

Here is a simplified version of the code I have so far:

MainView.js


Ext.define('APP.view.MainView', {
extend: 'Ext.grid.Panel',
alias: 'widget.MainView',
columnLines: true,
enableLocking: true,
initComponent: function() {
this.columns = []; // won't know until run-time

/* initialize the docked item inner grid */
var store = Ext.create('APP.store.InnerGrid');
store.load();
var viewInnerGrid = Ext.create('App.view.InnerGrid', {store: store});
this.dockedItems = [{
dock: 'bottom',
items: [viewInnerGrid]
}];

this.callParent(arguments);

}, // initComponent

viewConfig: {
listeners: {
cellclick: function(view, cell, colIdx, record, row, rowIdx, eOpts) {
var store = Ext.create('APP.store.InnerGrid');
store.getProxy().extraParams.partId = record.get('partId');
store.load();
view.store = store;
view.viewInnerGrid = Ext.create('APP.view.InnerGrid', {store: store});

/*
// at this point need to refresh inner grid
// tried view.doLayout(), view.refresh(), view.doComponentLayout()
// also tried view.panel - no joy yet
*/
}
}
}
});


I cannot seem to get at this inner grid in order to refresh it.... any ideas?

Thanks.

-Les

Gary Schlosberg
7 Apr 2014, 10:26 AM
I don't believe grids are intended to be docked in other grids. Please consider posting back here if you find a way to do this.

lcarbonaro
7 Apr 2014, 10:36 AM
Hi Gary, and thanks for taking the time to reply to my question.

I figured it was not doable, so I worked around it by opening the "docked" grid in a second, separate window just below the first one. I made sure to re-position the windows relative to each other, so they always look and behave like they are one window. Similarly, when the main window is closed, I make sure to close the "docked" grid.

It took some playing around, but it works, and users seem happy :-)

Thanks again.