Angular Table Sort Order


Topic: Angular Table Sort Order

wpay asked 4 years ago

Expected behavior Table sorting should allow specifying the default column and direction.

Actual behavior Documentation does not appear to indicate if it is possible to define the default sort column and direction. The default appears to be the last column, but I need the first column. Sorting is working as intended otherwise.


Arkadiusz Idzikowski staff commented 4 years ago

Can you provide more information about the use case of the 'default column' feature?


wpay commented 4 years ago

Right now the right most column is the default for being sorted. Why? Why not the left most column. I think in the JS version of MDB you can specify which column is sorted before anybody clicks a header. I suspect there is a way to do that, just not seeing it.

Use case: I have a table of five columns. The REST API sorts the data by the first column. MDB Angular's table sort feature changes that and sorts by the last column. A user has to click the first column header to put the sorting back in the intended order.


wpay commented 4 years ago

Disregard this, it was an error in my code. I was sorting the data received from the API, not the datatable.


wpay answered 4 years ago

While the perceived behavior was my own doing and error, it might be a nice feature to be able to specify which column is sorted by default. Though I have inadvertently discovered how to do that in code with a simple sort function.


FREE CONSULTATION

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

Status

Closed

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 9.3.1
  • Device: Desktop PC
  • Browser: Edge (Chromium)
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No