Hi,
in this post http://ko.infragistics.com/community/forums/t/75037.aspx, on the 10-29-2012 I asked about events to be caught in order to know when user clikced on OK, Cancel or Close button of a RowEditTemplate dialog.It was IgniteUI 2012.2.
Now I re-ask, is there a better way than this one:
$("#grid_one").live('iggridupdatingroweditdialogclosed', function (event, ui) { if (event.buttons == 0) { // Ok button $("#grid_one").igGrid("saveChanges"); } });
to catch user click buttons in IgniteUI 2013.1? Also because now I need to understand when user clicks OK button and when Close button...All these is because calssic iggridupdatingeditrowended is not caught whe RowEditTemplate is enable...
Thanks,
Flavio M.
Hello Flavio,
Currently there is no straightforward way to determine which button is clicked. However I can provide you with the following solution:
rowEditDialogClosed: function (event, ui) { var $button = $(event.currentTarget).data("igButton"); //Done or Cancel buttons clicked if ($button) { var buttonCaption = $button.options.labelText; if (buttonCaption === "Done") { $("#grid_one").igGrid("saveChanges"); } } else { // Esc button pressed or X button clicked }}
Best regards,Martin PavlovInfragistics, Inc.
Hi Martin,
thanks. I think your implementation is much more clear than mine. I would like to implement it, but I am not able...Is this right?
$(document).delegate("#grid_1", "iggridupdatingroweditdialogclosed", function (e, args) { var $button = $(e.currentTarget).data("igButton"); //Done or Cancel buttons clicked if ($button) { var buttonCaption = $button.options.labelText; if (buttonCaption === "Done") { alert("DONE"); } } else { alert("CANCEL o X"); } });
I tried to debug it, but I can see only undefined on the $button var...while I am able to see $(e.currentTarget).data("igGrid").What am I doing wrong?
Thanks
In my sample I defined the event inline in the grid initialization. For the delegate event handler try using the following code:var $button = $(e.originalEvent.currentTarget).data("igButton");
The change is needed because of the event bubbling mechanism.
I am attempting to do the same thing and that is capture what button was pressed on the Dialog closed. but it seems that it is working. I have version 14.2 so this may not work the same?
The goal is that once the user presses the "Done" button. I create a new empty row. Any help on that would be appreciated also.
thanks
Yeah, you're right!
This works, even if I have to pay attention to the used language. "Done" if I use the English version, "Fatto" if I use the Italian one and so on...
But this is another point, localization one ;-)
Thank you Martin!!