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; } }
Hello Ankush,
Thank you for your feedback.
If I can provide further assistance, please let me know.
Regards,
Tsanna