PDA

View Full Version : [Solved] Refresh not working for grid.



scblue
10 May 2010, 1:45 AM
Hi,

I'm trying to refresh my grid with a button, but somehow, this code is not working:



buttons : [{
id : 'reload-project'+obj_id,
text : 'Reload',
iconCls: 'icon-reset',
handler: function(){
Ext.getCmp('project-grid-'+obj_id).getStore.reload();
Ext.getCmp('project-grid-'+obj_id).render();
}
},{
id : 'edit-project'+obj_id,
text : 'Edit',
iconCls: 'icon-edit-record',
handler: function(){
updateForm(objarr);
}
}This button is located in a panel that is different that of the grid.
I want to refresh the grid when I added new data to to the database.
Does that make sense? :)

Thanks.

Animal
10 May 2010, 1:58 AM
render? It's already rendered.

How have you debugged this?

scblue
10 May 2010, 5:06 PM
Hi Animal,

Sorry, it was a desperate measure.
Initially it was only the getStore.reload() line, but I found some threads when I searched for help and one of the solution given was this.
And Firebug didn't throw any errors. That was what baffled me.

Does it matter if the grid is in a different panel?

Thanks.

scblue
10 May 2010, 7:16 PM
Thanks Animal, I've got it working.
It was but a silly mistake.

I forgot the parentheses in getStore().

It's this:

Ext.getCmp('project-grid-'+obj_id).getStore().reload();