PDA

View Full Version : problem with onRender - this.view is null



bbxx
16 Aug 2009, 12:22 PM
I am overriding the onRender function on a gridpanel, because I want to load the store when the gridpanel is loaded. Problem is, the super class is giving an error. Firebug is showing: this.view is null. Am I doing something wrong? Thanks



var feedUploadGrid = new Ext.grid.GridPanel({
store: feedUploadStore,
columns: [
{hidden: true, dataIndex: 'ID'},
{header: "Feed Name", width: 120, dataIndex: 'feedName', sortable: true},
{header: "Status", width: 180, dataIndex: 'status', sortable: true},
{header: "Description", width: 115, dataIndex: 'description', sortable: true},
{header: "Import Date", width: 100, dataIndex: 'importDate', sortable: true},
{header: "Adjustments", width: 115, dataIndex: 'adjustments', sortable: true},
{header: "Pending Adjustments", width: 100, dataIndex: 'pendAdjustments', sortable: true},
{header: "Pending Insert", width: 115, dataIndex: 'pendInsert', sortable: true},
{header: "Imported", width: 100, dataIndex: 'imported', sortable: true},
{header: "Errors", width: 115, dataIndex: 'errors', sortable: true},
{header: "Pending Updates", width: 100, dataIndex: 'pendUpdates', sortable: true},
{header: "Total", width: 100, dataIndex: 'total', sortable: true}
],
sm: new Ext.grid.RowSelectionModel({singleSelect: true}),
viewConfig: {
forceFit: true
},
split: true,
region: 'center',
onRender:function() {
Ext.grid.GridPanel.superclass.onRender.apply(this, arguments);
//this.store.load();
}
});

Animal
16 Aug 2009, 12:31 PM
Why bother?

If it's a remote store, kick off the loading process ASAP! By the time the data trundles back along the wire, the Grid will have been rendered.

bbxx
16 Aug 2009, 12:42 PM
because this is an enterprise app - other people may be working on the backend data, and I want the grid to have up to date data every time it is pulled up.


Why bother?

If it's a remote store, kick off the loading process ASAP! By the time the data trundles back along the wire, the Grid will have been rendered.

Animal
16 Aug 2009, 12:45 PM
It will! You should start off the loading process as soon as possible. It is the slowest part of the operation, so get the request started as early as you possibly can.

bbxx
16 Aug 2009, 2:55 PM
I loaded the store in onReady. Then I click on the tab group that has my grid. I see 7 rows of data. Then I go to mysql and delete 2 rows, leaving 5. I click onto a different tab group, and then back to my grid, and it still shows the original 7. This isn't what I want. I want it to show 5.

mjlecomte
16 Aug 2009, 3:36 PM
So, you have a grid in a TabPanel and every time someone clicks on the tab associated with the grid you want to query the server for the latest data? If so, use one of the TabPanel events to trigger loading the store for that grid again.

bbxx
16 Aug 2009, 4:27 PM
Thanks mjlecomte. That's probably what I should do.

Am I doing something wrong with:


mainTabPanel.on('tabchange', function(tpanel, tab) {
alert('test');
});
It's not alerting me when I switch tabs

mjlecomte
16 Aug 2009, 7:28 PM
I take the easy way out and use this technique sometimes:
http://extjs.com/forum/showthread.php?p=33940#post33940

You can limit what your observe to the TabPanel of course.

bbxx
16 Aug 2009, 7:34 PM
Thanks, I will look at that. But is there a reason why the small code snippet I had above isn't working?

mjlecomte
16 Aug 2009, 7:49 PM
dunno. looks ok if that actually points to a TabPanel.

bbxx
16 Aug 2009, 7:52 PM
It's a GroupTabPanel

Edit: I just tried this with TabPanel and it works. I need this to work with GroupTabPanel... I thought GroupTabPanel would inherit this event from TabPanel?

bbxx
16 Aug 2009, 9:15 PM
I figured it out. I put the listener on one of the tab groups, instead of the entire GroupTabPanel