If I set up a function to call when a RowSelector is clicked, how do I use the ui.grid to get the selected row? From your help :
$(document).delegate(
".selector"
,
"iggridrowselectorsrowselectorclicked"
function
(evt, ui) {
// get reference to the igGrid the igRowSelectors are initialized for
ui.grid;
});
var row = $(ui.grid).igGridSelection('selectedRow');
var row = ui.grid.igGridSelection('selectedRow');
So how do I access the selected row or rows (if multiple selection is enabled)
Thank you
Hello C J,
Thank you for posting in our community.
In order to get reference to the igGrid from the rowSelectorClickedEvent what I can suggest is using ui,grid.element. This could be achieved as following:
$(document).delegate("#cbRowSelectors", "iggridrowselectorsrowselectorclicked", function (evt, ui) { var row = $(ui.grid.element).igGridSelection('selectedRow'); //if multiple selection is enabled the selectedRows method should be used to return the collection of selected rows alert("Selected row index is :" + row.index); });
In case that you have multiple selection enabled the selectedRows method should be used to return the collection of selected rows.
I am also attaching a small sample demonstrating my suggestion for your reference.
I hope you find this information helpful.
Please let me know if you need any further assistance with this matter.