1

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

1 Answer 1

1

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.

1
  • Thanks, that makes sense. I will close this ticket. Mar 20, 2019 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .