Forum
23:49
26/01/2010
I think there could be a bug with the editRow method and calling the succesfunc.
In inline editing, when I edit a row for the 1st time, successfunc is called & I display my message returned from the server. Which is perfect. However, if I edit the same row again immediately, successfunc is not called. If I edit a different row, successfunc is called. So to recap, iff its the same row being edited, it gets called ony the first time & never again, unless I edit a different row. This is therefore a bug.
When I do inline edit I have as follows:
$.subscribe('rowselectStandardGrid', function(){
var id = jQuery("#"+gridName).jqGrid('getGridParam','selrow');
if(id && id!==lastsel){
jQuery("#"+gridName).jqGrid('restoreRow',lastsel);
jQuery("#"+gridName).jqGrid('editRow',id,true,null,successFuncStandardGrid);
lastsel=id;
}
});
function successFuncStandardGrid(data){
var message = JSON.parse(data.responseText).message;
return displayMessage(message, 'messageDiv');
}
22:44
Moderators
30/10/2007
Hello,
It depend maybe what you return from server when the row is edited for second time.
Please check this. Her is the code sniplet for this event:
if (stat === "success"){
var ret;
if( $.isFunction(succesfunc)) { ret = succesfunc.call($t, res);}
else { ret = true; }
if (ret===true) {
.....................................................
if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
if( $.isFunction(aftersavefunc) ) { aftersavefunc.call($t, rowid,res); }
} else {
$($t).jqGrid("restoreRow",rowid, afterrestorefunc);
}
}
I hope you can check this.
Kind Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
14:34
26/01/2010
Hi Tony
I have just checked and I basically send the exact same request and I get back the exact same response from the server.
1st response which calls successfunc:
since message starts with Error, I know its an error and then I will return false(this means my message is displayed and row edited is restored to original value)
2nd response which does not call successfunc after editing the same cell immediately after:
{"gridModel":null,"message":"Error: Editing Document Phase START. This Phase Already exists.","page":0,"phase":{"phaseId":null,"phaseName":"START","projectId":null},"phaseList":[],"phaseName":null,"phaseNameHeader":null,"records":0,"total":0}
I also return an error from this request, however the row edited is NOT restored to its original value but to the new value which is incorrect(because successfunc should return false, but it obviously doesnt.)
I even tried renaming my successFuncStandardGrid to just successfunc but it still didnt work.
This problem only happens when I do consecutive editing of the same row. I wonder if some value is being cached and only re-sets when its a different row.
Is there anyway you can test the scenario I described to see if you can reproduce it?
many thanks
17:55
Moderators
30/10/2007
Hello,
Humm very interesting.
Sorry to say this, but If I do all the test cases described from the user problems I will not have time to sleep .
Please in order to localize the problem, prepare a exmple and send me a link. I my opinion this is not a jqGrid problem, but without proof I'm not sure about this
Kind Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
15:39
26/01/2010
Hi Tony
I understand about if you do every test case you will be in trouble 🙂
I dont really have a live system I can give you an example of. I do use the Struts2 Jquery plugin which makes use of jqgrid and is located here:
http://www.weinfreund.de/strut.....dex.action
However I dont think its a plugin issue because I do call jquery directly when this problem occurs.
The simple scenario that can be tested is that if one edits a row (in inline editing, I only use inline editing in all my grids) & and error occurs its works fine the 1st time and the grid restores the data back because an error occurs. However if you dont click on any other row, but inline edit the exact same row immediately, If an error occurs on the server, my grid takes no notice of this error and simply saves the data on client grid(even though server has failed).
In the mean time, I have downloaded the last struts2-jquery plugin example war and I want to see if I can replicate this problem on it. If I can, I will update you here. But this is potentially a critical issue.
thanks & regards
16:12
26/01/2010
Hi Tony
I have just proved this problem also on the plugin I talked about earlier in my previous post. At least thats good news and it means that its not only in my application but can occur in other applications.
Do you suggest I put in this bug also in the struts2-jquery plugin forum? I dont want to confuse this by putting it in 2 places.
All I did to prove my post was that onSelectRow, I call this below(I ensure that for every eidt I call my successFuncStandardGrid and always return false). Again the 1st time, the row doesnt update as this function returns false. But next time I edit the same row, this function doesnt get called and updates the row.
var lastsel;
$.subscribe('rowselectStandardGrid', function(){
var id = jQuery("#gridedittable").jqGrid('getGridParam','selrow');
if(id && id!==lastsel){
jQuery("#gridedittable").jqGrid('restoreRow',lastsel);
jQuery("#gridedittable").jqGrid('editRow',id,true,null,successFuncStandardGrid);
lastsel=id;
}
});
function successFuncStandardGrid(data){
alert('successfunctionstandardgrid: will return false');
return false;
}
I await your advice.
18:59
Moderators
30/10/2007
Hello,
I think that everthing is in this logic:
if(id && id!==lastsel){
jQuery("#gridedittable").jqGrid('restoreRow',lastsel);
jQuery("#gridedittable").jqGrid('editRow',id,true,null,successFuncStandardGrid);
lastsel=id;
}
Try this
if(id){
...
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
22:21
26/01/2010
Hi Tony
I tried your suggestion but still the same problem.
I copied that logic you said could be the problem in your previous post from the jqGrid wiki at:
http://www.trirand.com/jqgridw.....ne_editing
Its very interesting why this problem happens!
09:37
Moderators
30/10/2007
Hello,
For me is strange too.
Kind Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
00:38
14/09/2010
I debugged this and found grid.inlinedit.js line 184 *loses* the definition of successfunc on second call.
Lines 182-184 of grid.inlinedit.js:
if (stat === "success"){
First-time call, successfunc has definition and is called.
Second-time call, successfunc is "undefined".
Same request to server; same response from server!
Is there bug?
11:57
Moderators
30/10/2007
HEllo,
Since the bug can not be reproduced from me - please send a link to the problem.
Thank you
Kind Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
35 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66