Have you tried extending your query with:
order by nvl(:P121_SORT_BY,1) desc
And then add a dynamic action that does a refresh of report region on change of your select list.
Thanks, but that doesn't work, and it's the first thing I tried. It was then, when I placed the "ORDER BY 1" clause when I saw that the sorting doesn't work in an IR if you place it in the APEX query.
It works for other reports, but NOT interactive reports.
In your IR report setting remove/uncheck sort option and include your order by clause in SQL report of your IR, then it will take effect from Query.
Thanks, but that means, you won't let the user sort by any other column if he/she wants to...
I found the answer to my question by navigating through the java scripts in Apex.
So this is what's working:
gReport.last_col_id = 'BCV';
Where 'BCV' is actually your column heading name, and you can send it through a Page Item, and 'DESC' means descending, and 'ASC' means ascending.
I hope this helps other people too.