PDA

View Full Version : Grid refresh problem in diferent window



intro
6 Aug 2010, 3:35 PM
Hi I am having a problem with refreshing grid in the old window after submiting the form in another window.
Please can you can see what is going on, I am working with extjs Designer.How can I refresh grid in diferent window after sending data to db.

Thanks





Web design and programming Croatia : Intro d.o.o. (http://www.intro.hr)

intro
7 Aug 2010, 1:46 AM
Here is my code :
AddUser = Ext.extend(AddUserUi, {
initComponent: function() {
AddUser.superclass.initComponent.call(this);
this.SpremiAddUser.on('click', this.SpremiAddUserClick, this);
Ext.QuickTips.init();
// turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side';



},
Thank you in advance...

SpremiAddUserClick: function() {
// your implementation here!

this.Form_add.getForm().submit(
{
url: 'dataadd.php',
success: function(form, action){
Ext.grid.GridAdmin.store.reload();
this.close();


},
failure: function(form, action){
alert('Something went wrong...');
},
scope: this

}



);


}

});
Ext.reg('AddUser', AddUser);

jarrednicholls
9 Aug 2010, 5:26 AM
Hi Intro,

Your approach is correct. My only question is: what is Ext.grid.GridAdmin? Is that an instance of your grid? If it is, then what you are doing should work correctly. It seems more like a class constructor/function to me though, which will not work.

Your project doesn't contain an Ext.grid.GridAdmin component/class, so I can't see for sure whether that call will work. However, calling myGrid.store.reload(); will refresh your grid, assuming you have access to the grid instance. You can either make the grid instance globally accessible, or you can pass it as a reference to your AddUser window:



var grid = new Ext.grid.GridAdmin();
// ...
var win = new AddUser({
// available as "this.gridAdmin" in AddUser functions
gridAdmin: grid
});


Let me know if that helps and/or if you figure it out.

intro
11 Aug 2010, 1:14 PM
Thanks here is my code and is working
this.Form_add.getForm().submit(
{
url: 'dataadd.php',
success: function(form, action){
Ext.Msg.alert('Obavijest', 'Vaši podatci su poslani na upisani e-mail!');

this.close();
Ext.StoreMgr.get('MyStore').reload();
},
failure: function(form, action){
alert('Something went wrong...');
},
scope: this

});

jarrednicholls
12 Aug 2010, 11:56 AM
Great!