Get the key value of the row of whose cusstom button has been clicked
I found myself in need of what i guess should be a trivial requirement. i
have a jqGrid in which i have added a custom button in each row. now i am
able to associate a client side click event with it but i want to know the
key value (Id) in my case of the row whose custom button was clicked, so
that i can proceed with this id and do whatever i want to do.
My code for jqGrid is as below
jQuery("#JQGrid").jqGrid({
url: 'http://localhost:55423/JQGrid/JQGridHandler.ashx',
datatype: "json",
colNames: ['', 'Id', 'First Name', 'Created Date', 'Member Price',
'Non Member Price', 'Complete', 'customButton'],
colModel: [
{ name: '', index: '', width: 20, formatter:
"checkbox", formatoptions: { disabled: false} },
{ name: 'Id', index: 'Id', width: 20, stype: 'text',
sortable: true, key: true },
{ name: 'FirstName', index: 'FirstName', width: 120,
stype: 'text', sortable: true },
{ name: 'CreatedDate', index: 'CreatedDate', width:
120, editable: true, sortable: true, hidden: true,
editrules: { edithidden: true} },
{ name: 'MemberPrice', index: 'MemberPrice', width:
120, editable: true, sortable: true },
{ name: 'NonMemberPrice', index: 'NonMemberPrice',
width: 120, align: "right", editable: true, sortable:
true },
{ name: 'Complete', index: 'Complete', width: 60,
align: "right", editable: true, sortable: true },
{ name: 'customButton', index: 'customButton', width:
60, align: "right" }
],
rowNum: 10,
loadonce: true,
rowList: [10, 20, 30],
pager: '#jQGridPager',
sortname: 'Id',
viewrecords: true,
sortorder: 'desc',
caption: "List Event Details",
gridComplete: function () {
jQuery(".jqgrow td input", "#JQGrid").click(function () {
//alert(options.rowId);
alert("Capture this event as required");
});
}
});
jQuery('#JQGrid').jqGrid('navGrid', '#jQGridPager',
{
edit: true,
add: true,
del: true,
search: true,
searchtext: "Search",
addtext: "Add",
edittext: "Edit",
deltext:"Delete"
},
{/*EDIT EVENTS AND PROPERTIES GOES HERE*/ },
{/*ADD EVENTS AND PROPERTIES GOES HERE*/},
{/*DELETE EVENTS AND PROPERTIES GOES HERE*/},
{/*SEARCH EVENTS AND PROPERTIES GOES HERE*/}
);
Help or any pointers would be much appreciated.
No comments:
Post a Comment