Is it possible to add jquery datatable to Salesforce Lightning:Datatable? I know its possible to add it in normal html table (using table id), but not sure how to do the same with Lightning:Datatable (since it auto generates html table). Thanks.

Jquery datatable- https://datatables.net/ SF Lightnign datatable - https://developer.salesforce.com/docs/component-library/bundle/lightning:datatable/example


No, you won't be able to combine those two things. One of the core features of Lightning is that you cannot reach across namespaces to interact with the DOM entities rendered by other components, including standard components like <lightning:dataTable>.

This is protected by Lighting's Locker Service. In particular, see DOM Access Containment:

A component can only traverse the DOM and access elements created by a component in the same namespace. This behavior prevents the anti-pattern of reaching into DOM elements owned by components in another namespace.

It will not allow your components, in the local c namespace, to access DOM components rendered by the lightning or aura namespaces.

You can use either <lightning:dataTable> or jQuery Data Tables, but not both as part of the same table at the same time.

  • Thanks, that makes sense. I will close this ticket. – Sidharth Agarwal Mar 20 '19 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.