Forum

July 12th, 2025
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Why Data in the Grid still Update? (afterSubmit Case)
29/09/2009
21:18
Avatar
tonier
Member
Members
Forum Posts: 3
Member Since:
30/09/2009
sp_UserOfflineSmall Offline

It 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:

afterSubmit: function(r,d) {
                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

02/10/2009
10:42
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

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.

02/10/2009
20:22
Avatar
tonier
Member
Members
Forum Posts: 3
Member Since:
30/09/2009
sp_UserOfflineSmall 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.

afterSubmit: function(r,d) { // check data returned from server
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.

Forum Timezone: Europe/Sofia

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

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information