before/afterSelectionChange for Cells
Hi again,
I'm trying to perform an action after you click on any cell in a row -- so Im using the afterSelectionChange() function. Bu I want to avoid having the entire row selected. Is there an equivalent way to fire this event when a cell is selected?
I've tried calling beforeSelectionChange(), performing the desired action, then calling the afterSelectionChange() to deselect the row. This causes an infinite loop until memory runs out.
The basic functionality I'm trying to achieve is that an action is performed when a cell is clicked. Focus/highlight can remain on the cell, but not the row.
Best,
Louis W
we can look into adding hooks for before/after cell selection, for now you would just want to use a cellTemplate with an ng-click directive that passes in the current row and column so you can decide what to do with it,
On Fri, Apr 12, 2013 at 11:18 AM, Louis Wilbrink [email protected]:
Hi again,
I'm trying to perform an action after you click on any cell in a row -- so Im using the afterSelectionChange() function. Bu I want to avoid having the entire row selected. Is there an equivalent way to fire this event when a cell is selected?
I've tried calling beforeSelectionChange(), performing the desired action, then calling the afterSelectionChange() to deselect the row. This causes an infinite loop until memory runs out.
The basic functionality I'm trying to achieve is that an action is performed when a cell is clicked. Focus/highlight can remain on the cell, but not the row.
Best,
Louis W
— Reply to this email directly or view it on GitHubhttps://github.com/angular-ui/ng-grid/issues/335 .
-Tim Sweet
Great idea, thanks a lot.
I know this is a closed issue, but I wanted to be able to get the current row when arrow-ing around in an excel-like grid. I had to turn off selection highlighting because it interfered with the arrow-ing around. I spent several hours trying different approaches (ng-blur doesn't work on divs in the cell templates, etc.) and finally found that I can do this:
$scope.$watch('gridDatasheetOptions.$gridScope.selectionProvider.lastClickedRow', function(){ $scope.onRow = scope.gridDatasheetOptions.$gridScope.selectionProvider.lastClickedRow.entity; });
Which works perfectly. Hopefully will save someone else a little time!
ken.