Material-table: Add hook when detailPanel is opened or closed

Created on 31 Oct 2019  路  7Comments  路  Source: mbrn/material-table

Is your feature request related to a problem? Please describe.
I am needing to update my height in a SwipableView component whenever a detail panel is opened or closed. Is there a possibility to add a onDetailPanelOpen and onDetailPanelClose callback so that we can provide a function to do additional work when this event happens?

Describe the solution you'd like
When a detailPanel is opened, trigger onDetailPanelOpen optional user provided function
When a detailPanel is closed, trigger onDetailPanelClose optional user provided function

Describe alternatives you've considered
none, we get no event when the panel is opened or closed

Additional context
I am using my table within SwipableView component and need to tell SwipableView to update its height due to the content of its view had changed due to the detailPanel being opened or closed.

wontfix

All 7 comments

It would be nice to have this feature. An onClick event on the detailPanel.

Created a pull request on this issue:
#1452

Example:

detailPanel={[
          {
            icon: 'account_circle',
            tooltip: 'Show Account details',
            onClick: rowData => {                 // new onClick hook
              console.log(rowData)
             // onClick action e.g. fetch data
            },
            render: rowData => {
              // render something
            }
          }
        ]}

I was looking for this exact feature this morning. Thank you very much for adding it in!

This is possible already in onRowClicked, you have the togglePanel(). You can trigger your own event from inside that.

onRowClick={(event, rowData, togglePanel) => togglePanel()}

Not the most direct path, but could unblock you for now.

I tried that, but it didn't work for me. If somebody needs this feature quickly, the forked package can be installed via npm.

It would also be nice to have a way to check if a rows detail panel is open. Possibly a flag on the data row object.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jlgreene2 picture jlgreene2  路  3Comments

diegosps picture diegosps  路  3Comments

KKrisu picture KKrisu  路  3Comments

VipinJoshi picture VipinJoshi  路  3Comments

behrouz-s picture behrouz-s  路  3Comments