Why is my sort put line 9 second?

I’ve created a report and found some code to add a selectable drop down to the dialog. This part works perfectly. The only strange part is that it sorts it very strange. I’m choosing a Transfer Order and then selecting some or all of the lines from it. If I have an order with 9 or more lines and choose them all, it sorts them like this

1;9;2;3;4;5;6;7;8;10;11;12…etc

If I have an order with 8 lines or less, it sorts them in order. I cannot figure out why.

Here is the code in my UIBuilder

select inventTransferLine
                order by inventTransferLine.LineNum
                where inventTransferLine.TransferId == orderNum;
            if(inventTransferLine)
            {
                DS = query.addDataSource(tableNum(InventTransferLine));
                qbr = DS.addRange(fieldNum(InventTransferLine, TransferId));
                qbr.value(orderNum);                
                DS.fields().addField(fieldNum(InventTransferLine, LineNum));
                DS.fields().addField(fieldNum(InventTransferLine, ItemId));    
                DS.addOrderByField(fieldNum(InventTransferLine, LineNum));
                selectedLines = [tableNum(InventTransferLine), fieldNum(InventTransferLine, LineNum)];
            }

        SysLookupMultiSelectCtrl::constructWithQuery(this.dialog().dialogForm().formRun(), dialogLines.control(), query, false, selectedLines);

pastedimage1630348246979v1.png

pastedimage1630348283499v2.png

Can someone see in the code if I’m doing something wrong?