Skip to content

Select rows after setting data #2267

@MuadDib

Description

@MuadDib

I have a need to select rows programmatically after data is loaded. For example select row0 as soon as data is loaded.

Data, when loaded, is obviously missing $$hashkey and thus unable to be selected. I created ugly workaround by calling select function with $timeout.

This doesn't work:

    $scope.gridOptions.data =  someData;
    $scope.gridApi.selection.selectRow($scope.gridOptions.data[0]);

This works:

    $scope.gridOptions.data =  someData;
    $timeout(function () {
        $scope.gridApi.selection.selectRow($scope.gridOptions.data[0]);
    },
    100)

I spent some time trying to find event after data is processed by ui-grid but I was unable to. If there is any more elegant solution it would be quite appreciated,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions