Lucian
04-25-2007, 03:30 AM
Hi there!...
I have a grid with multiple rows. When I select a row and then press an Edit button, a small dialog window appears. Inside that dialog I have a dynamic form, the fields of that form are filled with some server-side data. That works for the first time, but when I select another row and I push the edit button, the data of the window is unchanged, because there was no other call to the server.
Here is the code I use :
editDg = new Ext.LayoutDialog("page-edit-dlg", {
modal:false,
width:700,
height:380,
shadow:true,
minWidth:300,
minHeight:200,
proxyDrag: false,
center: {
autoScroll:true,
tabPosition: 'top',
closeOnTab: true,
alwaysShowTabs: true
}
});
editDg.addKeyListener(27, editDg.hide, editDg);
editDg.addButton('Save', editDg.hide, editDg);
editDg.addButton('Cancel', editDg.hide, editDg);
var layout = editDg.getLayout();
layout.beginUpdate();
var CenterPanel = Ext.DomHelper.append(document.body, {tag:'div ', cls:'CenterPanel'}, true);
layout.add('center', new Ext.ContentPanel(CenterPanel, { title:'Content', autoScroll:true, fitContainer:true, fitToFrame:true}));
updater = CenterPanel.getUpdateManager();
updater.disableCaching = false;
updater.update({url: '/admin/contents/edit/' + id + '/', scripts:true, nocache: true, discardUrl:true});
updater.on("beforeupdate", function (object){console.log('beforeupdate');}, this, true);
updater.on("update", function (object){console.log('update');}, this, true);
// generate some other tabs
layout.add('center', new Ext.ContentPanel(Ext.id(), {autoCreate:true, title: 'Charts', background:true}, 'charts to be displayed!'));
layout.endUpdate();
What FireBug is saying:
- a first call to the server as "GET http://localhost/myproject/admin/contents/edit/22/?_dc=1177484923875 (234ms)"
- only "update" is logged
- on second row selected, updater.update() is never called, although I have "discardUrl: true", so the content remains the same, which is wrong.
It should make a second call to the server, right?...And why "beforeupdate" event is not logging?...
I'm using the latest release of Ext-1.0, downloaded today.
And yes...ExtJS is a great piece of art...
I have a grid with multiple rows. When I select a row and then press an Edit button, a small dialog window appears. Inside that dialog I have a dynamic form, the fields of that form are filled with some server-side data. That works for the first time, but when I select another row and I push the edit button, the data of the window is unchanged, because there was no other call to the server.
Here is the code I use :
editDg = new Ext.LayoutDialog("page-edit-dlg", {
modal:false,
width:700,
height:380,
shadow:true,
minWidth:300,
minHeight:200,
proxyDrag: false,
center: {
autoScroll:true,
tabPosition: 'top',
closeOnTab: true,
alwaysShowTabs: true
}
});
editDg.addKeyListener(27, editDg.hide, editDg);
editDg.addButton('Save', editDg.hide, editDg);
editDg.addButton('Cancel', editDg.hide, editDg);
var layout = editDg.getLayout();
layout.beginUpdate();
var CenterPanel = Ext.DomHelper.append(document.body, {tag:'div ', cls:'CenterPanel'}, true);
layout.add('center', new Ext.ContentPanel(CenterPanel, { title:'Content', autoScroll:true, fitContainer:true, fitToFrame:true}));
updater = CenterPanel.getUpdateManager();
updater.disableCaching = false;
updater.update({url: '/admin/contents/edit/' + id + '/', scripts:true, nocache: true, discardUrl:true});
updater.on("beforeupdate", function (object){console.log('beforeupdate');}, this, true);
updater.on("update", function (object){console.log('update');}, this, true);
// generate some other tabs
layout.add('center', new Ext.ContentPanel(Ext.id(), {autoCreate:true, title: 'Charts', background:true}, 'charts to be displayed!'));
layout.endUpdate();
What FireBug is saying:
- a first call to the server as "GET http://localhost/myproject/admin/contents/edit/22/?_dc=1177484923875 (234ms)"
- only "update" is logged
- on second row selected, updater.update() is never called, although I have "discardUrl: true", so the content remains the same, which is wrong.
It should make a second call to the server, right?...And why "beforeupdate" event is not logging?...
I'm using the latest release of Ext-1.0, downloaded today.
And yes...ExtJS is a great piece of art...