Topic: Sort Datatables in a date column as in MDB4

Dylan DeMarco priority asked 6 months ago


Title: Regression: Ability to assign sortable hidden properties to table cells (as found in previous versions)

Description: In earlier versions of MDB, it was possible to associate a hidden property with a cell that could be used for sorting. For example, in a column of text-formatted dates, the cell could have a hidden property that was the Unix timestamp of the date. Users were able to indicate that the column should be sorted using this hidden property. This feature now appears to be absent or non-functional in the most recent version.

Expected behavior: Users should be able to assign a property to a given cell (hidden or otherwise), which could later be used for sorting. In a column of text-formatted dates, a cell could contain a hidden property — for example, the Unix timestamp of that date. It should be possible to indicate that this column uses the hidden property for sorting.

Actual behavior This feature does not seem to exist in the current version, or if it does, it is nonfunctional. Attempting to sort a table column based on the hidden properties of its cells does not result in the expected sorted order.

Resources (screenshots, code snippets etc.) This is an example of how the feature used to function:

<td class="align-middle" data-sort="{{ row.timestamp }}">
                    {{ row.localized_time }}
 </td>

Kamila Pieńkowska staff answered 6 months ago


Here is a snippet example showing how to use data-mdb-value attribute: https://mdbootstrap.com/snippets/standard/kpienkowska/5718439


Kamila Pieńkowska staff answered 6 months ago


This feature kind of exists. But still, it takes the same types of values as regular cells. Which means string, number, or date in a specific format.


Dylan DeMarco priority commented 6 months ago

So, in this case, the timestamp is a number (seconds since epoch). I would like to display the localized string format of the date but sort by the number. Could you provide an example of how I could use that existing functionality then?

Thanks for your help!



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