Hi All,
I’m trying to get the delete row function work…
Here’s the part of the code :
// delete row.
$("#deleterowbutton").bind('click', function () {
var selectedrowindex = $("#jqxgrid").jqxGrid('getselectedrowindex');
var rowscount = $("#jqxgrid").jqxGrid('getdatainformation').rowscount;
if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
var id = $("#jqxgrid").jqxGrid('getrowid', selectedrowindex);
$("#jqxgrid").jqxGrid('deleterow', id);
}
console.log(selectedrowindex);
console.log(id);
});
looking at the console log : ‘selectedrowindex’ is always -1 and ‘id’ is : undefined which of course results that the delete function is not working…
Here’s the deleterow function :
id: 'RecordID',
deleterow: function (rowid, commit) {
console.log('HERE');
// synchronize with the server - send delete command
var data = "delete=true&" + $.param({RecordID: rowid});
$.ajax({
dataType: 'json',
url: '../jqw/data.php',
cache: false,
data: data,
success: function (data, status, xhr) {
// delete command is executed.
commit(true);
},
error: function(jqXHR, textStatus, errorThrown)
{
commit(false);
console.log(data);
}
});
}
What am I doing wrong here? Thanks in advance.