Hi guys,
I am trying to delete a row with the img. It works just fine when I copied your example with button as the last column, however when I change button to img only first row gets deleted.
Last Column:
{title: "", editable: false, sortable: false, render: function (ui) {
//return "<button type='button' class='delete_btn'>Delete</button>";
return "<img src='images/Remove button.gif' id='imgRmv' width='17' height='17' hspace='0' />";
}
}
refresh: function () {
$("#imgRmv")
.unbind("click")
.bind("click", function (evt) {
var $tr = $(this).closest("td"),
rowIndx = $grid.pqGrid("getRowIndx", { $tr: $tr }).rowIndx;
alert('RowIndx: ' + rowIndx);
$grid.pqGrid("addClass", { rowIndx: rowIndx, cls: 'pq-row-delete' });
var ans = window.confirm("Are you sure to delete row No " + (rowIndx + 1) + "?");
if (ans) {
$grid.pqGrid("deleteRow", { rowIndx: rowIndx, effect: true, complete: function () {
$grid.pqGrid("removeClass", { rowIndx: rowIndx, cls: 'pq-row-delete' });
}
});
}
else {
$grid.pqGrid("removeClass", { rowIndx: rowIndx, cls: 'pq-row-delete' });
}
});
},
cellBeforeSave: function (evt, ui) {
var isValid = $("#grid_array").pqGrid("isValid", ui);
if (!isValid.valid) {
evt.preventDefault();
return false;
}
}
};