Skip to content

How to manually toggle a detailrow on/off? #179

Answered by shlomiassaf
ahmed-habbachi asked this question in Q&A
Discussion options

You must be logged in to vote

@ahmed-habbachi You need to get the instance of the detailRow plugin and then provide the row you want to toggle on/off.

To get the plugin instance:

const detailRowPlugin = PblNgridPluginController.findPlugin(gridInstance, 'detailRow');

And then, just toggle it:

detailRowPlugin.toggleDetailRow(row);

Where row is the data row to toggle (the actual data object)

Note that this only works for rendered rows, i.e. if virtual scroll is enabled only the visible rows can get toggled.

See a working example here:

https://codesandbox.io/s/ngrid-detail-row-programmatic-toggle-r2fcf?file=/src/app/app.component.ts:2150-2236

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by shlomiassaf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #166 on March 31, 2021 14:38.