I've implemented paging in the great CodeCamper SPA by John Papa. While doing so, I have found something strange when using the take() and skip() functions.
Consider the following ODATA query for skipping 2 records and take 2:
/api/Breeze/Sessions?$orderby=TimeSlotId%2CLevel%2CSpeaker%2FFirstName&$skip=2&$top=2&$select=Id&$inlinecount=allpages
This returns:
[{"$id":"1","$type":"IB_pMnaszsw5zIeP0Q7Dam12XmjGGg[[System.Int32, mscorlib]], IB_pMnaszsw5zIeP0Q7Dam12XmjGGg_IdeaBlade","Id":3},{"$id":"2","$type":"IB_pMnaszsw5zIeP0Q7Dam12XmjGGg[[System.Int32, mscorlib]], IB_pMnaszsw5zIeP0Q7Dam12XmjGGg_IdeaBlade","Id":14}]
Now I skip 4 records and take 2 (as if moving to the next page)
/api/Breeze/Sessions?$orderby=TimeSlotId%2CLevel%2CSpeaker%2FFirstName&$skip=4&$top=2&$select=Id&$inlinecount=allpages
This returns:
[{"$id":"1","$type":"IB_pMnaszsw5zIeP0Q7Dam12XmjGGg[[System.Int32, mscorlib]], IB_pMnaszsw5zIeP0Q7Dam12XmjGGg_IdeaBlade","Id":14},{"$id":"2","$type":"IB_pMnaszsw5zIeP0Q7Dam12XmjGGg[[System.Int32, mscorlib]], IB_pMnaszsw5zIeP0Q7Dam12XmjGGg_IdeaBlade","Id":11}]
I am getting the record with Id 14 twice ! I can reproduce this issue with any number of pages or records.
Any idea what's going on ?
[EDIT]
Ok, I've noticed that if get rid of the orderby ($orderby=TimeSlotId%2CLevel%2CSpeaker%2FFirstName&) then everything's fine. How come the orderby is causing a problem ?