Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Retain custom properties when instantiating datatable

Dylan DeMarco priority asked 1 year ago


Expected behavior If I am creating a datatable using a div with the class datatable around HTML, I would expect that custom data- attributes defined in the cells to be present in the final rendering. For example:

<!-- In my HTML file-->
<td data-my-custom-prop="42" ><small>Cell content</small></td>
...
<!-- when inspecting the element on the rendered page -->
<td [...styles from formatCell] data-mdb-field="field_3" false="" data-my-custom-prop="42">
            <small>Cell content</small>
 </td>

Actual behavior

 <!-- In my HTML file-->
<td data-my-custom-prop="42" ><small>Cell content</small></td>
...
<!-- when inspecting the element on the rendered page -->
<td [...styles from formatCell] data-mdb-field="field_3" false="">
            <small>Cell content</small>
 </td>

I.e. the custom prop is not carried into the rendered datatable

Resources (screenshots, code snippets etc.)


Grzegorz Bujański staff answered 1 year ago


We are currently working on more extensive tables. We do not plan to add such a feature in Datatables, but our new product will allow you to set custom classes, styles, and data attributes


Dylan DeMarco priority commented 1 year ago

Good to know! Thank you. In the meantime, I found a workaround for anyone else with a similar goal: if you put the cell content inside a within the table cell and give the div the custom property, it will be retained!



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No