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.
The below code is working fine with Chrome, but giving undefined error when accessed through IE10 or firefox.
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; } }
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.
Hello Ankush,
Thank you for your feedback.
If I can provide further assistance, please let me know.
Regards,
Tsanna
Yes I modified the GetSelectedNominationPayments() method as given below, which resolve the error I was getting.
Were you able to resolve your issue? If you need further assistance, please let me know.
Thank you for posting in our community.
I tested iggrid row selection scenario and was not able to reproduce the behavior that you're experiencing. The row id is correctly returned on rowSelectionChanged event when using Up/Down arrow keys to navigate through the rows. I used the following sample to test this: http://igniteui.com/grid/selection
Could you please send me your sample to test it on my side? It would be great appreciated.
Looking forward to your response.