Get selected row only through templates?
I modified my rowTemplate to tell me when a row is selected, is there another way to get the selected row object without the use of a template?
gridOptions.selectedItems contains the selected rows. Is that what you need?
I was hoping you might say that. I'm not using checkboxes, just selecting the row, and $scope.gridOptions never contains a selectedItems array. Do i need to set that up as an empty array when I init the grid so that once I've selected a row, it will populate it? I'll look for examples of selectedItems being used.
Yea you can do:
$scope.mySelections = [];
$scope.gridOptions = {
// ...
selectedItems: $scope.mySelections
}
Now its working, thanks for that!
nicely explained here.. http://coding-issues.blogspot.in/2013/09/getting-selected-rows-from-ng-grid.html
This is working for initial selection. When i change the data of the grid (through some API call) and try to do a new row selection, then previous selected items are retained and the new selections are appended to the previous list. Setting the value of the selectedItems to [] is not working.
http://plnkr.co/edit/CncDWCktXTuBQdDVfuVv
Once the value is set after the initial load, it is not changing.