grid.getSelectedRowId ordering

I have a grid that has multiple rows selected and i need to make sure that i keep the ordering intact i.e.

Row1 (selected)
Row2 (selected)
Row3 (selected)
Row4
Row5 (selected)

So when i call grid.getSelectedRowId i would need Row1:Row2:Row3:Row4 to be passed keeping the order based on the row index.

Is there an overload to the getSelectedRowId to do this or is there another function to be called that will do this? Failing that, have you any other suggestions on how to do this without getting too involved in javascript.

Thanks
Martin

Unfortunately the getSelectedRowId method stores the rows in the order they were selected. So the first selected row will be the first in the list coming from the method.
Unfortunately such behavior cannot be changed.
May only suggest you to sort the list manually accordingly to your needs.