Hi,
I have used igGrid control to display list of records. I have added rowSelectionChanged event to perform some action when user selects a row. Below is the code:
Grid Initialization
{
name: "Selection",
mode: "row",
multipleSelection: false,
touchDragSelect: false, // this is true by default
multipleCellSelectOnClick: false,
rowSelectionChanged: GetSelectedNominationPayments
}
.
GetSelectedNominationPayments
==========================
function GetSelectedNominationPayments(event, args) {
if ($("#gridInvoices").data("igGrid") != null) {
if (HasPendingTransactions($("#gridInvoices"))) {
var answer = confirm("You have unsaved changes on this form. If you continue, you will lose these changes. Do you still wish to continue?");
if (answer == true) {
$("#hdfNominationID").val(args.row.id);
LoadPaymentDetails(args.row.id);
else {
return false;
It works fine as long as I use mouse to select a row. But when I use Keyboard UP/DOWN arrow keys, I don't get "args.row.id"(primary key value), because of which the code is breaking.
Please let me know how I can get row.id in this scenario.
Yes I modified the GetSelectedNominationPayments() method as given below, which resolve the error I was getting.
if (typeof event.originalEvent === "undefined") { nominationID = args.row.id; } else { var eveType = event.originalEvent.type; switch (eveType) { case "mouseup": nominationID = args.row.id; break; case "keydown": nominationID = args.row.element.context.dataset.id; break; } }
The below code is working fine with Chrome, but giving undefined error when accessed through IE10 or firefox.
Object "dataset" in "args.row.element.context.dataset" is coming null in IE10 and Firfox but giving proper rowid in Chrome.
Please let me know if there is any workaround for this.