4

I'm using Angular UI Grid and the ui-grid-expandable plugin. Is there a way to decide for each row, if the expand button (+) is displayed? By default it is always displayed, no matter if there is available data in the subgrid.

Thanks.

1

4 Answers 4

5

Sadly no, there is not an option for that as of now.

You can use the following to make things work as you wish:

  • remove default row headers by setting to false enableExpandableRowHeader
  • adding a custom row header by calling $scope.gridApi.core.addRowHeaderColumn

This way you can build your own logic. I did something like that in this plunkr.

If you need more info:

Sign up to request clarification or add additional context in comments.

Comments

0

I have a pull request with UI-GRID that solves this.

You add a boolean to the subGridOptions called disableRowExpandable.

https://github.com/angular-ui/ui-grid/pull/6135/commits/83ade3445711e532f689d224904babfe92c7b45e

Comments

0

Yes you can !

Add to subGridOptions object this option:

disableRowExpandable:(condition here).

Comments

0

Just use the last version of UI GRID

https://cdnjs.cloudflare.com/ajax/libs/angular-ui-grid/4.11.0/ui-grid.min.js

Then use the property disableRowExpandable inside your subGridOptions

Here there a little example.

for (i = 0; i < response.data.result.length; i++) {
                    if (response.data.result[i].SubProcesos != null) {
                        response.data.result[i].subGridOptions = {
                            columnDefs: establecerColDefs(response.data.Rol),
                            data: response.data.result[i].SubProcesos,
                            disableRowExpandable: false

                        };
                    } else {
                        response.data.result[i].subGridOptions = {
                            columnDefs: [{ }],
                            data:[{}],
                            disableRowExpandable: true
                    };
                    }
                }

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.