How To Sort Dataprovider In Specific Order

How to sort Dataprovider in specific order based on our values not ascending or descending ?

Specify an order clause in the CDbCriteria used for the Dataprovider.

$dataProvider=new CActiveDataProvider(

		Student::model()->cache(60, null, 2),














I want the in this order (‘5806’,‘9144’,‘8983’,‘9046’,‘9047’,‘6208’)


So, what is the rule behind that order?

If you could state the rule, then you would be able to sort them according to it.

There is no rule behind it. I just want to display few things in a specific order.

Hmm, I’m sorry I have no idea.

Or should I say that I don’t understand your exact needs or use case.

Why can you predict the ids of Students whose status is valid?

Would you please try to state what you want to do in a broader context?

I select few students and display them in the homepage. But those student’s id is random. I need to display them in the order which I wish.

So you want to sort by students’ name?

Your request is not clear.

I sort by students behavior which is tracked manually.

Try with this in dataprovider

'criteria' => array('order' => new CDbExpression('RAND()'))