This is a migrated thread and some comments may be shown as answers.

[Solved] Cancelling AddNewRow in BatchEdit Telerik Grid

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Claudio
Top achievements
Rank 1
Claudio asked on 20 Apr 2012, 02:51 PM

I am trying to prevent users to enter more than a set number of rows per header in a batch edit mode grid.
how to cancel the event ? Anybody has done that before ?
I will paste my javascript below but preventDefault does not cancel the event.
Thank you for all your support
Claudio

     var icounter = 0;
     //========================================
     function Grid_onLoad(e) {

         icounter = document.getElementById('TotalGriRowCount').value;

     }
     //========================================
     function Grid_onEdit(e) {
         var I_MAXLINES =5;
         if (e.mode == "insert")
         {
             if ((icounter + 1) > I_MAXLINES) {
                 alert("Not allowed to enter more than " + I_MAXLINES + " rows per header !");
                 e.preventDefault();
             }
             else {
                 icounter++;
             }
         };
         return;
     }
     //========================================
     function Grid_onDelete(e) {
         icounter--;
         return;
     }
     //========================================

1 Answer, 1 is accepted

Sort by
0
Claudio
Top achievements
Rank 1
answered on 20 Apr 2012, 03:54 PM
i think i found the answer to my problem :

$(

 

this).find('.t-grid-cancel-changes').click();

will do the trick

Tags
Grid
Asked by
Claudio
Top achievements
Rank 1
Answers by
Claudio
Top achievements
Rank 1
Share this question
or