Skip to content

restoreState triggering multiple filterChanged events #5280

@tbaeg

Description

@tbaeg

When restoring a particular grid state with several filter parameters I noticed the filterChanged event triggered several times invoking the listener several times (in my case a bunch of ajax requests).

Base on the documentation (and code), the event doesn't return which filter changed so it seems useless to trigger all those events especially in the context of restoring state. Is this by design? If not, this seems like a bug to me. It would be better if it watched for changes similar to sortChanged.

I don't have a plunkr, but a simple way to reproduce would be to have multiple filters applied to a grid, save the state, restore the state. The grid.api.core.on.filterChanged should trigger several times when restoring the grid state.

Where the filterChanged event is invoked: https://github.com/angular-ui/ui-grid/blob/master/src/features/saveState/js/saveState.js#L592.

Where the sortChanged event is invoked: https://github.com/angular-ui/ui-grid/blob/master/src/features/saveState/js/saveState.js#L610

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions