angularjs – 如何使Angular ui网格最初扩展所有行?

前端之家收集整理的这篇文章主要介绍了angularjs – 如何使Angular ui网格最初扩展所有行?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用ui grid来显示数据列表,我正在尝试初始扩展所有行.

我试图在onRegisterApi事件中执行此操作:

scope.GridOptions =
        {
            data: properties,columnDefs: 
            [
                { name: "Full Address",field: "FullAddress" },{ name: "Suburb",field: "Suburb" },{ name: "Property Type",field: "PropertyType" },{ name: "Price",field: "Price",cellFilter: 'currency'},{ name: "Status",field: "Status" },{ name: "Sale Type",field: "SaleType" },{ name: "Date Created",field: "CreateDate",cellFilter: "date:'dd/MM/yyyy HH:mma'"}
            ],expandableRowTemplate: 'template.html',expandableRowHeight: 200,onRegisterApi: (gridApi) => 
            {
                scope.gridApi = gridApi;
                gridApi.expandable.on.rowExpandedStateChanged(scope,(row) =>
                {
                    if (row.isExpanded) {
                        this.scope.GridOptions.expandableRowScope = row.entity;
                    }
                });
                gridApi.expandable.expandAllRows();

            }
        };

但上面的代码不起作用.看起来当我调用expandAllRows()时,行还没有渲染.

就我而言,以下工作:
$scope.gridOptions = {
      ...
      onRegisterApi: function(gridApi) {
        $scope.gridApi = gridApi;
        $scope.gridApi.grid.registerDataChangeCallback(function() {
          $scope.gridApi.treeBase.expandAllRows();
        });
      }
    };

猜你在找的Angularjs相关文章