ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

afterSelectionChange fires when selection is unchanged

Open jrussell-ivantage opened this issue 13 years ago • 2 comments

The function registered with the grid option afterSelectionChange is called whenever selectItem is used regardless of whether the selection actually changed or not. I tweaked the selectItem demo plunker to demonstrate what I mean: http://plnkr.co/edit/rMmeiD.

Notice that repeated clicks of the "Select Enos Row" button (which is just selecting an already selected row after the first click) still increments the afterSelectionChange counter.

Is this intended behavior? Should I just be checking against the list of selectedItems to stop redundant calls to afterSelectionChange? Is there a better workaround?

jrussell-ivantage avatar May 01 '13 20:05 jrussell-ivantage

To me it makes sense that afterSelectionChange would only be called if the selected row is actually changed. Otherwise it's just a row-click event, right?

c0bra avatar May 01 '13 21:05 c0bra

Agreed.

If not, perhaps the name afterSelectionChange should be updated to reflect the fact that it may be called when the selection has not changed?

jrussell-ivantage avatar May 01 '13 21:05 jrussell-ivantage