I have a json object which I am binding with a Listbox. In the UI I have the moveUp/movedown functionality in which user can reorder the positions of the items in the listbox. I have written a custom sorting functionality which would sort the items based on ordinal property and binds with the listbox.
In the MoveUp funtion, after changing the ordinal positions of the listbox items, still the sorting doesn't happen i.e. positions of the items are not re-arranged. What I am missing here ?
Please find the code in plunker
MoveUp()
{
var selectedOrdinal = this.selectedValues.ordinal;
var targetOrdinal = (selectedOrdinal != 1) ? selectedOrdinal - 1 : 1;
var temp = this.StoryPagesList;
temp[targetOrdinal].ordinal = selectedOrdinal;
temp[selectedOrdinal].ordinal = targetOrdinal;
this.StoryPagesList = temp;
}