Friday, October 6, 2017

Expand row immediately after populating ui grid with data?

I want to expand the row in the ui grid immediately after populating it with data.

This is the function for populating the data.

    $http({
        url: '/Parameters/GetQuarterJson',
        data: { AccountID: $scope.selectedProject, Year: $scope.selectedYear },
        method: 'POST'
    }).then(function (response) {
        $scope.quarterGrid.data = response.data;
    });

And this is the function which is called based on some condition right after populating data to expand the row.

    $scope.paramerterGridApi.expandable.collapseAllRows();
    var index, rows = $scope.quarterGrid.data;

//$scope.quarterGrid.data contains the new data

    for (index = 0; index < rows.length; index++) {
        if (rows[index].Quarter === $scope.selectedQuarter) {
            $scope.paramerterGridApi.expandable.expandRow(rows[index]);

//but $scope.paramerterGridApi.grid.rows doen’t contains it

        }
    }

That’s why the row doesn’t expand. How can i achieve this?

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/10/06/expand-row-immediately-after-populating-ui-grid-with-data/
via @lzomedia #developer #freelance #web #lzomedia.com

No comments:

Post a Comment