This question is locked. New answers and comments are not allowed.
hello,
i would like to ask how i can intercept the ajax delete functionality of a grid using ajax binding? specifically, up to the point wherein after i click on delete, as the confirm prompt pops up, i would like to do something based on the user's choice,
basically, if OK, do this, if CANCEL do that..
regards,
Mr. Gil
4 Answers, 1 is accepted
0
Peter
Top achievements
Rank 1
answered on 15 May 2010, 06:03 PM
Hi,
You can try to wire click event of the delete button. For instance, this code snippet should do the trick:
Anyway, if you need to understand what is the answer of the user, you should call confirm instead of the grid.
Give it a try.
Regards,
Peter
You can try to wire click event of the delete button. For instance, this code snippet should do the trick:
| $('#Grid').delegate('.t-grid-delete', 'click', 'your function here')); |
Anyway, if you need to understand what is the answer of the user, you should call confirm instead of the grid.
Give it a try.
Regards,
Peter
0
lhar gil
Top achievements
Rank 1
answered on 16 May 2010, 03:20 AM
hello mark,
thank you for the reply. however, i cannot seem to make the delegate() function work, its not firing at all.
the following is the code snippet, basically just trying to pop-up an alert message instead of the default "Are you sure you want to delete this record?".
| $('#MyGrid').delegate('.t-grid-action t-button t-state-default t-grid-delete', "click", function () { |
| alert("delete clicked"); |
| }); |
i have tried the .live() method but it fires after the "Are you sure..." popup. what im trying to do is either to replace the "Are you sure..." message into a customized one or trap the user choices (OK/CANCEL) because i need to update certain portions of the markup depending on the choice..
regards,
Mr. Gil
0
Kou
Top achievements
Rank 1
answered on 25 Aug 2011, 07:56 AM
Hi Gil,
Did you find the solution for this? i too in the same kind of requirement. If you found any solution can you share here?
Did you find the solution for this? i too in the same kind of requirement. If you found any solution can you share here?
0
Kenneth
Top achievements
Rank 1
answered on 08 Aug 2012, 08:55 PM
Bump? =)
Seriously though, the fact that the client-side OnDelete event gets fired before the result of the delete confirm is really weird. If OnDelete is triggered regardless of the confirm result, how are we supposed to know if something gets successfully deleted or not?
Additionally, the lack of events for the confirm result is also frustrating. I'd like to know whether the user confirmed or cancelled the Delete so I can respond appropriately in code.
Seriously though, the fact that the client-side OnDelete event gets fired before the result of the delete confirm is really weird. If OnDelete is triggered regardless of the confirm result, how are we supposed to know if something gets successfully deleted or not?
Additionally, the lack of events for the confirm result is also frustrating. I'd like to know whether the user confirmed or cancelled the Delete so I can respond appropriately in code.