I am using the ui grid to show a list of data, and I am trying to expand all rows first.
I am trying to do this in the onRegisterApi event:
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(); } };
But the code above does not work. It looks like when I call expandAllRows (), the rows are not yet displayed.
angularjs angular-ui angular-ui-grid
Yang zhang
source share