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: Ad a custom hidden id in datatable row

efilippi priority asked 2 months ago


Hello,

I need to retrieve a custom row unique id (for example database id) when I click on a datatable row to launch some processings. This row unique id should not be visible in the table.

I found that the datatable generates a row index via the data-mdb-index attribute and a field index via the data-mdb-field attribute. But these are for datatables internal purposes.

Is there a way to add a custom row id with the js advanced data structure, using a custom data attribute or using a hidden column, or any other way ?

Thank you for rout answer.


Kamila Pieńkowska staff answered 2 months ago


I've prepared a snipped: https://mdbootstrap.com/snippets/standard/kpienkowska/6270540

there you will see that rowIndex that is logged keeps the index from the original array that was provided for datatable initiation, so can be used to distinguish rows.



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: MDB5 7.2.0
  • Device: laptop
  • Browser: firefox
  • OS: windows
  • Provided sample code: No
  • Provided link: No