Link to home
Start Free TrialLog in
Avatar of Amar-ms
Amar-ms

asked on

jqGrid response after Add/Edit/Delete?

Hi,

I am trying to use the jqGrid +jQuery with edit, add, delete can i display a message on the grid, whether the save/update/delete was successful or not?

an java/spring example would be perfect.
Avatar of Nithyanandhan_T
Nithyanandhan_T
Flag of United States of America image

You needn't do any Java/Spring logic. You will be doing add/update/delete operation in the AJAX call(may be using Jquery) ..
1) Place a <DIV it="myStatus"> just above the table, which can display your add/update/delete status
2) Based on the response of your AJAX call, decide your message

for example if AJAX call failed for ADD

if(failed){
document.getElementById("myStatus").innerHTML="Failed to add the record"
}

Avatar of Sathish David  Kumar N
As Nithyanandhan said is correct !!

ur using jGrid define in jsp that time u can define the div tag ....


Other wise u can set msg (succes or failer ) in ur controller at request scope

and u can get the  resuest scope variable in JSP using JSTL tag ....

Avatar of Amar-ms
Amar-ms

ASKER

Thanks guys, but what i am looking for is displaying the message on the form pop-up not the actual page.
then its simple..

do this in your javascript...

var status = <your AJAX call response>;

if(status){
alert("Your operation failed");
}else{
alert("Your operation completed successfully");
}

if you want to do a popup window instead of alert  then you can use window.open
Avatar of Amar-ms

ASKER

want to show it on the form itself not as a alert or a pop-up.
what do you mean by "form itself"?
Early you have mentioned "form pop-up"...

Do you have a form in a pop-up and want to display the message there? In that case you can do the same logic which I mentioned... using <DIV>
logic doesn't change based on your target place for message display...

Please make your statements clear.. it will save both of our time!!
ASKER CERTIFIED SOLUTION
Avatar of Sathish David  Kumar N
Sathish David Kumar N
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial