Inherit Interactivity/properties in DataTable

For example, say we have multiple data tables in the app. I want all the data table to have certain Interactivity like filter enables, able to delete columns etc.

Can we define it globally for the app so that I don’t have to add the code to each data table for the features
OR
I have to add this to each data table individually?

I’d recommend writing your own function that returns a DataTable with the properties that you want

1 Like

@chriddyp Thank you for replying.

In that case, I wouldn’t be able to expand it. For example, if I want one DataTable to be editable, I cannot add that to the returned DataTable from the function? Or is there a flexibility to do that?

May be I didn’t articulate that in my original question…The intention is to have base template and expand it for specific use cases.

right - you would pass in something like **kwargs and merge the custom properties with your default properties

That’s great, @chriddyp.

Can you kindly point to an example with code? Appreciate it :]

Variations of this:

def MyCustomTable(**kwargs):
    return dash_table.DataTable(editable=True, **kwargs)

app.layout = MyCustomTable(data=[...])