Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
bDev
Posts: 40
Registered: ‎12-14-2013
My Device: Playbook
My Carrier: Orange
Accepted Solution

Sorting calendar events

Hi,

 

Any idea how to sort the calendar events based on the event's date, that is, the event nearer should be at the top of the list? Any api to do the same. I'm trying hard to get it done.

 

Thanks

Please use plain text.
Developer
Spacena
Posts: 120
Registered: ‎02-06-2013
My Device: Dev Alpha C
My Carrier: airtel

Re: Sorting calendar events

Try this

EventSearchParameters searchParameters;
    QPair<SortField::Type,bool> sort;
    sort.first = bb::pim::calendar::SortField::StartTime;
    sort.second = false;

searchParameters.setSort(sort);

 now pass this as a parameter to the events() method of the CalendarService class and you have the sorted events based on starttime

 

if you want to reverse the order, set the bool value to true



There are 2 types of IT companies in the world:

One that says "I have a website."
and another that says "I am a website !"
Please use plain text.
New Developer
bDev
Posts: 40
Registered: ‎12-14-2013
My Device: Playbook
My Carrier: Orange

Re: Sorting calendar events

Thanks that worked.

Please use plain text.