Iterate through Calendar List by Date Instead of When Created

My problem is that this function:

$(xData.responseXML).SPFilterNode("z:row").each(function () {});

iterates through my Calendar using the date the item was created by. I need it to tell me what the next events are in order of real time, and if I add an event in the middle of the two events, it should insert that into the order, not add it to the end.

For example, I have 3 events, one on M, W, and F. I have it set up that it writes the next 3 events to text in HTML, to display on my homepage. If I then add an event on Tuesday, what I want is for the homepage to only display M, T, and W, and then the event on Friday isn't seen anymore (until the event on Monday has passed, and it is no longer displayed).

I've considered pushing the events into an array and using a bubble sort or some other kind of sorting mechanism to re-sort the array based on the event date, rather than the date of creation, but I'm looking for a simpler solution.

Can anyone help with

September 4th, 2015 3:47pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics