sorting numerically with text in front of the number
sorting numerically with text in front of the number

Hello I am trying to sort a column based on a room number in this format 'room no 151'. Currently it is not sorting correctly. If I sort descending it sorts room numbers based on the first number even if it is a 3 digit number ex:
Room no. 2
Room no. 1
Room no. 151
Is there a way to parse the number after the text?
thanks
This discussion has been closed.
Answers
You need to have DT render the field one way for display and another way for sorting.
https://datatables.net/reference/option/columns.render
Hi Thom I don't see any of the examples in the link you presented sorting on a text + number string? I am unsure as to how it would work.
you will need to write a function that returns just the number for the sorting rendering.