Using jquery DataTables

I am trying to find a way to use jQuery DataTables (Installation) for a table in Dash.

Generating the html table isn’t the big fuzz, but I am struggeling with applying the DataTable() on it. Can anyone please guide me on the right application of external_scripts, client_callback & co.

Help is appreciated.

Unfortunately, this isn’t something that is all that feasible with Dash. From the Dash FAQs:

Q: Can I use jQuery with Dash?

A: For the most part, you can’t. Dash uses React to render your app on the client browser. React is fundamentally different to jQuery in that it makes use of a virtual DOM (Document Object Model) to manage page rendering. Since jQuery doesn’t speak React’s virtual DOM, you can’t use any of jQuery’s DOM manipulation facilities to change the page layout, which is frequently why one might want to use jQuery. You can however use parts of jQuery’s functionality that do not touch the DOM, such as registering event listeners to cause a page redirect on a keystroke.

In general, if you are looking to add custom clientside behavior in your application, we recommend encapsulating that behavior in a custom Dash component.

1 Like