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.