Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by F.bockelee on Nov 04, 2009 00:31
open dhtmlx forum
dataprocessor caching url

Hi,

I meet a strange behavior with dataprocessor.

On server side, the update url use data coming from processor (gr_id, c0,c1,...) and data coming from session.
data coming from processor are quite poor : an id and all others are null.

The first time i use my grid , all work fine, but always work wrong the second time i made the same action.
I use dataprocessor in debug mode : all seem ok, good action sent the first and the second time. and good return xml.

I use debug on the server side : the first action is really send, but never the second !!!

Exact workaround :

1) Adding a row in grid with id 1 : the row is inserted in grid and in database
2) Deleting the same row in grid with id 1 : the row is deleted in grid and in database
3) Re-adding a row in grid with id 1 : the row is inserted in grid, but not in database
--> dataprocessor in debug mode : ok, url said to be send to the server
--> server side : the updateConsultant action is not triggered

the first and the second action have strictly the same url (for the case the grid don't work)

so i suspect strongly the fact that the update url is cached by IE.
Do you know a simple way to avoid that ?

i tried to use preventIEcaching(true), but it don't seem work for the dataprocessor url.

I think that i have 2 solutions :
- updating the dataprocessor.js file by adding "&uid="+(new Date()).valueOf()) before calling the url.
- putting special timestamp data in the grid so the url will be different (this is more difficult, impacting almost of code)

Thanks if you have an advice

example script (not the true one wich is more complex)

mygridConsultant = new dhtmlXGridObject("gridConsultant");
mygridConsultant.setImagePath("images/");
mygridConsultant.loadXML("./Contrat.do?reqCode=remplirConsultant&xml", function() {
myDataProcessor = new dataProcessor("./Contrat.do?reqCode=updateConsultant&xml");
myDataProcessor.setUpdateMode("cell");
myDataProcessor.init(mygridConsultant);
})


Answer posted by Alex (support) on Nov 04, 2009 03:23
Hello,

you can try to use POST method instead of GET (default):

   dp.setTransactionMode("POST")

Ids in grid should be unique. So, you shouldn't add row with the same id as existent - in the other case the data from the 1st row will be sent to the server (not from the last one).
Answer posted on Nov 04, 2009 08:10

 

As writed in my post :

Exact workaround :

1) Adding a row in grid with id 1 : the row is inserted in grid and in database
2) Deleting the same row in grid with id 1 : the row is deleted in grid and in database
3) Re-adding a row in grid with id 1 : the row is inserted in grid, but not in database

so the row is inserted (ok) and deleted (ok) and reinserted (not ok)

as i use : myDataProcessor.setUpdateMode("cell");

so the writing must be immediate (and it is, except for the 3rd case) : when i do the second insert, the first one is no more in grid. 

i make the following change in dataprocessor.js :

in _sendData:function

i replace

var a3=this.serverProcessor;

by

var a3=this.serverProcessor + ((this.serverProcessor.indexOf("?")!=-1)?"&":"?") + "uid=" + (new Date()).valueOf();

and ALL WORK FINE.

This must be useful for another people (the case was particular, because of same url, wich is not current)