PDA

View Full Version : discardUrl is ignored


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...

tryanDLS
04-25-2007, 02:34 PM
How are you calling update the 2nd time? What parms are you passing? Did you verify that you're even getting to updatemanager.update()? Use firebug to step thru your code. The first thing it does is fire beforeupdate, so if you're not logging that, I would suspect you never really call update. You're not creating the dialog and layout every time are you?

Lucian
04-26-2007, 01:50 AM
As I later understood, it was a false problem.
The events "beforeupdate" and "update" are fired, and the dialog window is created only once.
When I select another row and try to edit it, the same dialog window appears, so the content remains the same.
It's nothing buggy with the ExtJS at this moment, but a badly design of my app and I will have to rethink it... :">
My problem now is to find a way to refresh the content of that dialog every time I push a button. Or to give up on dialog and create a new region instead to show up the edit form.

Thanx for your time!...You can delete this post or close it by now.