Hi Team,
I am using igGrid row selector feature and I set it up like this.
{ name: "Selection", mode: 'row', persist : false, multipleSelection: false }
On UI, once I select one row, it doesn't let me select any other row. It always sends the same row selection data back and it even doesn't change the selected row color once I try to select any other row.
It only works the first time grid loads and it highlights the selected row and then never work again.
Any help ?
Hello Hamza,
I added Filtering, Sorting, Multi Column Headers and Resizing to my grid configuration. When I test it on my side everything works as expected and multiple rows can be selected by successfully selected.
features: [ { name: "Filtering", mode: "advanced", columnSettings: [ { columnKey: "ID", allowFiltering: false }, ], filterDialogContainment: "window" }, { name: "Sorting", applySortedColumnCss: false, }, { name: 'MultiColumnHeaders' }, { name: "Resizing" }, { name: "RowSelectors", enableCheckBoxes: true, enableRowNumbering: false }, { name: "Selection", mode: 'row', persist: false, multipleSelection: true } ]
In order to handle double click event you can use the jQuery dblclick() function and bind to igGrid directly to listen for double click events. In this event an ajax call can be used to perform a ajax request to the controller of your choice. Using data option of the ajax call any information can be sent in the call and will be available in your controller. For example:
createCboxSelectorsGrid(); $("#grid1").dblclick(function (event) { // row html element var row = $(event.target).closest('tr'); // data key value var dblClickRowID = row.attr("data-id"), //selected rows collection selectedRowsCollection = $("#grid1").igGridSelection("selectedRows"); //you can get any information abput teh selected rows and add it to the ajax call via its data option if (dblClickRowID !== null && dblClickRowID !== undefined) { $.ajax({ type: "POST", dataType: "json", url: '@Url.Action("doubleClick")', data: { rowID: dblClickRowID } }); } }); //Controler public ActionResult doubleClick(string rowID) { var key = rowID; //handle your requirement here return View(); }
I am attaching a small sample for your reference. Please test it on your side and let me know what is the behavior. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me along with steps to reproduce the issue.
Please let me know if you have any additional questions regarding this matter.
I have another question regarding that. Is there any event or property I can bind in igGrid which will give me the selected row data in my Controller ? I wrapped a grid with Jquery double click
grid.dblclick(function (event) {
$scope.showPopUp(event);
});
I want to pass the row data on which the double click happened ? Any way I can achieve that ?
Hi,
I have tried your fiddle, its just working fine. However in my case it isn't working. After first row selection, this isn't working. Ideally all I want is to pass the data from Jquery double click back to my controller. Below are my features. Feels like something isn't working properly.
features: [
{
name: "Filtering",
mode: "advanced",
columnSettings: [
{ columnKey: "ID", allowFiltering: false },
],
filterDialogContainment: "window"
},
name: 'MultiColumnHeaders'
name: "Sorting",
applySortedColumnCss: false,
name: 'Resizing'
name: "Selection",
mode: 'row',
persist: false,
multipleSelection: false
}
]
Thank you for posting in our community.
I created a small fiddle where I enabled Selection feature along with Row Selectors. I selected a row and afterwards I selected another one. On my side everything worked as expected and selection was correctly styled. I tested on Chrome, Firefox and Edge browsers (latest versions)
Please open this fiddle on your side and let me know what is the behavior. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send I t back to me for further investigation. If you are experiencing the same issue with my sample please get back to me with steps to reproduce the behavior.
Looking forward to hearing from you.