I have a JQGrid in which one of the columns I used font awesome icon[X] to perform delete row operation. Below is the code where I used delete()
function, expected that when I click on the div element the function would hits but does not happened and getting an error in developer tool like
"(function(event){DeselectMeasures(85)})"
, where 85 is the Id of my grid data.
Which is the best practice to perform this? Is there any alternative to produce [X] button as a last column and need to perform some operation before deleting?
$("#selectedMeasuresgridID").jqGrid({
datatype: 'function',
mtype: 'Post',
colNames: [ 'Delete'],
colModel: [
{ name: 'Delete', index: 'Delete', width: 50, editable: true, formatter: FACloseIcon, align: 'center' }
],
rowNum: 10,
rowList: [10, 20, 30, 40],
height: '100%',
viewrecords: true,
caption: '',
emptyrecords: 'No records to display',
autowidth: true,
loadComplete: function () {
//operations
}
});
function FACloseIcon(cellvalue, options, rowObject) {
return '<div onclick="Deselect(' + rowObject.Id + ')" class="fa fa-close deSelect" aria-hidden="true"></div>';
}
function Deselect(rowObject) {
//I will write code accordingly
}