Forum
Topic RSS
21:18
30/09/2009
OfflineIt is work perfectly, until I get a case.
I used FormEdit to edit my data in the grid and submit a new Data. However, when the data posted and then something happen and my DB server sent error status, I want my data that already updated by user in the Form Editor does not copy into the Grid. In other words, I do not want my data in the grid also updated, if my server sent any errors because the data that posted previously.
I tried to return [false,’error message’] using afterSubmit function like:
If(r.responseText == ‘error’)
{
return [false,’error error’];
}
return [true];
}
I thought if I return with [false] then the data in the grid will not be updated, but it is does not work like what I expected, data in my Grid still updated.
Currently I used trigger(‘reloadGrid’) to meet my needs.
Any help would be appreciated ...
Regards,
Toni
10:42
Moderators
30/10/2007
OfflineHello,
If (…) is not valid.
Try
if(…)
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.
20:22
30/09/2009
Offline
Thanks Tony, I have fixed my code.
Just figured out if I returned wrong value when I used JQuery "each" function. I returned array value for grid from the "each" function of JQuery instead "afterSubmit" function.
See the code below, maybe any users can learn what I have learnt.
var dt = r.responseXML;
$(dt).find('res').each(function()
{ // result
if($(this).find('ok').text() == '1')
{
eee = $(this).find('msg').text();
alert('Data Updated!');
return [true]; // <--- WRONG
}
else
{
eee =$(this).find('msg').text();
alert('Error:'+eee);
$('#useradm').trigger('reloadGrid');
return [false]; // <--- WRONG
}
});
return true;
}
There is nothing wrong with your code.
Thanks for a great work Tony.
Most Users Ever Online: 994
Currently Online:
43 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
Log In
Home