Forum


23:20

26/01/2010

Hi there, I have 2 issues that I am not sure if it is a bug in jqgrid or I am missing something.
Issue 1: when I add a row in my grid with these options, the add modal popup does NOT close:
navigatorAddOptions="{height:500,reloadAfterSubmit:false,afterSubmit:successFuncAdd,closeAfterAdd:true}"
If i dont include option afterSubmit like so: navigatorAddOptions="{height:500,reloadAfterSubmit:false,closeAfterAdd:true}"
It works fine & closes.
In my function succesFuncAdd, I set a brand new url & trigger a reload which works fine:
jQuery("#gridedittable").jqGrid('setCaption',gridCaption).trigger('reloadGrid');
Why then does the add popup modal not close after this? I tried to check in firebug but I got no error. I have tried to put the options in different order but it makes no difference. anyone with help on this? could this be an issue the struts2 plugin I am using?
Issue 2: Deleting a row. Basically when I delete a row I check my response from the server also by having an afterSubmit option.
If the server returns an error i return false. I am expecting jqgrid not to delete the row(since error from server as i returned false for afterSubmit function), However, jqgrid does delete the row. is this functionality correct by jqgrid?
To counteract this, I tried to simply restore the row by calling this in my afterSubmit option function:
jQuery("#gridedittable").jqGrid('restoreRow',id.id); & this did work.
However, after calling this restoreRow once, I cannot delete any other subsequent rows afterthat!! I get no error, delete simply doesnt work again. Very very strange.
Anyone with any ideas on these 2? Thanks for any help.
22:10

Moderators
30/10/2007

Hello,
Could you please post your two afterSubmit functions - i.e one for the adding and the other for the deleting.
Please consult here what should return therse funcions here (not simple false/true, but array)
http://www.trirand.com/jqgridw.....rm_editing
Best 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.
17:40

26/01/2010

Hi Tony
Here are my 2 peices of code below, I am probably missing something or not returning correctly at all. Just noticed in successFuncAdd, I am not returning anything. Not sure if thats it. But I do return true/false in my delete function.
Heres the add function..
var jsonResponseObj = JSON.parse(data.responseText);
var result = displayMessage(jsonResponseObj);//returns true/false if error from server =>false.we show messages when its success as well(true)
var newUrl = "documentControl/retrieveAll.action?oper=searchAdd";
jQuery("#gridedittable").jqGrid('setGridParam',{url:newUrl,page:1});
//reload grid
jQuery("#gridedittable").jqGrid('setCaption',gridCaption).trigger('reloadGrid');
}
& here is the delete one
var jsonResponseObj = JSON.parse(data.responseText);
var result = displayMessage(jsonResponseObj);
if(result == false){//restore row
alert("restore rowid: "+id.id);
jQuery("#gridedittable").jqGrid('restoreRow',id.id);
}else{
alert("yoooo id "+id.id);
}
return result;//will simply be true/false (false=>error& true=>success)
}
20:06

Moderators
30/10/2007

Hello,
As per documentation these events should return something. (Please look carfully here)
http://www.trirand.com/jqgridw.....ditgridrow
So in you case you should:
function function successFuncAdd((data,id)
{
...
return [true,"",""]
}
The same for the second event successFuncDelete
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:
51 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