angular-ui/ui-grid

[selection] - event rowSelectionChanged - pass GridCol along with GridRow

Open

#4534 aperta il 16 ott 2015

Vedi su GitHub
 (4 commenti) (1 reazione) (0 assegnatari)JavaScript (2496 fork)batch import
breakinghelp wantedtype: enhancement

Metriche repository

Star
 (5395 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

currently event rowSelectionChanged has the following signature:

on.rowSelectionChanged($scope, function (row, event) { ... })

I have a use case when I'd also find useful information about column being clicked.

Detailed scenario: Clicking on the row has an event associated (ex: redirects to another state). However, the very last column of each row is a custom column that allows deleting of that row. Currently clicking on the delete button in the given row will also trigger rowSelectionChanged event, which is not desired just for that column. Given that I had information about GridCol in this event, I could write something like:

on.rowSelectionChanged($scope, function(row, col, event) {
    if (col.name != 'delete') {
        $state.go('superState');
    }
});

This would be a breaking change since it would change the signature of the event. If I'm given a green light, I'll submit a PR.

Guida contributor