dash icon indicating copy to clipboard operation
dash copied to clipboard

Delete button disappears upon use of page_action setting

Open CoranH opened this issue 1 year ago • 1 comments

page_action being set disables the column deletable functionality (no icon/button). Minimal modified example from the docs:

from dash import Dash, dash_table, dcc, html, Input, Output, State, callback

app = Dash(__name__)

app.layout = html.Div([
    html.Div([
    dash_table.DataTable(
        id='editing-columns',
        columns=[{
            'name': 'Column {}'.format(i),
            'id': 'column-{}'.format(i),
            'deletable': True,
            'renamable': True
        } for i in range(1, 5)],
        data=[
            {'column-{}'.format(i): (j + (i-1)*5) for i in range(1, 5)}
            for j in range(5)
        ],
        page_action='custom',
        editable=True
        )])
    ])

if __name__ == '__main__':
    app.run(debug=True)
  • replace the result of pip list | grep dash below
dash                      2.18.2
dash-bootstrap-components 1.6.0
dash-core-components      2.0.0
dash-html-components      2.0.0
dash-table                5.0.0

  • if frontend related, tell us your Browser, Version and OS
    • Windows 11 Enterprise (23H2, 22631.4460)
    • Chrome (130.0.6723.117)

Describe the bug

When I copy the example for a column deletable datatable, the moment I add the "page_action" (set to 'custom') argument to the data-table ctor, the delete icon/button disappears. It is the same issue described here: https://github.com/plotly/dash-table/issues/511

Expected behavior

Delete icon to be visible/actionable with a page_action (to allow backend paging) also set. I don't know if this is intended but undocumented, if the user is expected to implement any data altering effects in the backend first.

CoranH avatar Nov 14 '24 17:11 CoranH

This appears to be a deliberate decision made by the dash team. Link.

Manually removing that flag, it results in an invalid prop combination as specified by validFSP

As to exact reasoning for these validations, is beyond my codebase-reading comprehension atm. I can only speculate that the use of page_action="custom" results in certain actions requiring you to write your own callbacks to handle their implementation (delete being one of them).

2Ryan09 avatar Jan 19 '25 19:01 2Ryan09