I have created a list box like this, and created a title bar which helps to sort data:
ID Name
--------------------------------------------------
You can use the custom array sort take a look at this How to sort select base on an id ?
The idea here is just create a arrray and sort that based on its value and than dynamically create the option based on the sorted value.
Custom sorting code
source.sort(function (x, y) {
if (isAsc)
return y.id - x.id;
else
return x.id - y.id;
});