Black Lives Matter. Please consider donating to Black Girls Code today.

Dash-table cells not editable even when editable=True

I have been trying to use the NEW DASH TABLE :heart_eyes: . It’s been great but I am facing some issues. The table is not editable even though I have specified editable=True and the checkboxes aren’t selectable. Am I doing something wrong? I went through the documentation for the table but couldn’t have it figured.

. Please see the attached gif.

CALLBACK::

@app.callback(Output('fileListTable2', 'data'),
              [Input('fileInput', 'value')])
def fileListUpdate(fileInput):
    newlist = []
    datec = []
    datem = []
    if os.path.isdir(fileInput):
        fileList = os.listdir(fileInput)

        for names in fileList:
            if names.endswith(".txt") or names.endswith(".csv") or names.endswith(".xls") or names.endswith(".xlsx"):
                newlist.append(names)
                datec = os.path.getctime(os.path.join(fileInput, names))
                datem = os.path.getmtime(os.path.join(fileInput, names))
    tess = pd.DataFrame({'File Name': newlist,
                         'File Created': datetime.fromtimestamp(datec).strftime('%Y-%m-%d %H:%M:%S'),
                         'File Modified': datetime.fromtimestamp(datem).strftime('%Y-%m-%d %H:%M:%S')},
                        columns=['File Name', 'File Created', 'File Modified'])

    return tess.to_dict('records')

LAYOUT ::

html.Div(
    dt.DataTable(
        columns=([{'name': 'File Name', 'id': 'File Name'}, {'name': 'File Created', 'id': 'File Created'},
                  {'name': 'File Modified', 'id': 'File Modified'}]),
        data=[{}],
        editable=True,
        id='fileListTable2')),

I’ll create an issue if anyone can confirm that its a bug.

There’s a known bug where a lot of the client side functionality of the DataTable doesn’t work unless it’s connected as an input to at least 1 working callback, see: https://github.com/plotly/dash-table/issues/202#issuecomment-436750407

Could be that?

1 Like

I see- great. Thank you very much. Let me try and update!

It works by including a callback. Thanks!

1 Like