0

Can anyone help me why grid.onDeleteRow() is not functioning/triggering when I delete a row in my grid?

This is my code for triggering it.

$("#CCR_RF_GRD_DTLWRKINSTRUCTION").click(function(){          
          $("#CCR_RF_GRD_DTLWRKINSTRUCTION").onDeleteRow(function(){
              alert('A row was deleted');
          });
});

Thanks in advance.

momouu
  • 711
  • 4
  • 14

2 Answers2

1

Try only with Document

$("#gridId").onDeleteRow(function(oGrid, aRow, rowIndex) { 
     //custom code here
})

function click not fired!

ashkufaraz
  • 5,179
  • 6
  • 51
  • 82
1

Try this code:

$("#yourbutton").on("click" , function() {
    //first delete all rows except for the first:
    var rows = $("#yourgrid").getNumberRows();
    for (var i=1; i < rows; i++) {
        $("#yourgrid").deleteRow();
    }
    //clear all fields in the grid:
    var aValues = $("#yourgrid").getValue();
    for (var i=1; i <= aValues[0].length; i++) {
        $("#yourgrid").setValue("", 1, i);
    }
} );

The above code deletes all the rows in your grid. If you only want 1, you can easily adapt it to delete just 1.

Ethan Presberg
  • 203
  • 1
  • 6