Possible to change WebListBox sorting behavior for numbers?

I’ve noticed that WebListBoxes don’t sort “numeric” columns correctly, or at least not the traditional way.

Say you have row values 5, 1, 10, 4, 48, 2. I’d expect this set to sort like 1, 2, 4, 5, 10, 48. The WebListBox will sort it like 1, 10, 2, 4, 48, 5.

It seems I don’t have any control over this from the docs, other than to disable sorting on those columns.

Is this a bug or the intended behavior? I know I can sort before populating the ListBox, but if there’s an easier way I’ll take it.

Is the normal behavior. You can see the same on a Desktop Listbox.
You will need to sort as you want.
You may want to create a feature request to add Datatables columns.type, to be able to define the column as numeric and sort by number and not A-Z.

1 Like

Alright, thanks for the info.

I’ll open a feature request if one doesn’t already exist.

Cells are strings. They sort as strings. If I have a column of numbers I want sortable, I add a zero left padded version of it to a celltag, rowtag or hidden column, and sort on that.

I think the issue is that WebListbox doesn’t have a RowComparison or CompareRows event to implement custom sorting code.

Alberto’s idea for defining the column type is the best approach, but it SHOULD NOT be tied to database, it should be a WebListbox enum.