Yii Dataprovider Asc Order With Reverse Output

Hi guys,

I’m using Yii’s dataprovider + listview now. I’m using this for a mailbox like Facebook. However, I noticed that facebook’s mailbox order is neither regular ASC or DESC, it’s actually ASC with an inverse order. Like all the conversation is in ASC order but when it comes to page view, you see the last page(newest) first and if you scroll up, you see like next(last) page with order record in ASC order.

How should I do this in Yii’s data provider? Since if I get ASC order, my first page will be the oldest page but not newest.

Thanks for your help!

You could do:




$dataProvider->setData(array_reverse($dataProvider->getData()));



before passing it to the widget.

Thanks so much it works.