Yii Grid Using Cformmodel

Hello,

Is there a way on how I can create a grid using CFormModel, just like setting the items inside the grid from a SQL statement and can be sortable by using WHERE keyword?

No, it’s not I think. There are special classes which do exactly what you want.

Why do you want to do it this way ?

You can use CArrayDataProvider or CSqlDataProvider for your CGridView.

But IMHO you should not try them until you encounter a really complicated demand that you would find it difficult to handle with CActiveDataProvider. It’s quite sure that they will require you a lot more coding than CActiveDataProvider.

Thank You guys,

I have searched CSqlProvider and apply it in a sample program but when I try it I received an erro saying:

PHP notice

Undefined index: id

/var/www/YiiProject2/yii/framework/web/CSqlDataProvider.php(119)

You can see my sample data here:

http://www.yiiframework.com/forum/index.php/topic/39470-cgrid-and-csqlprovider-undefined-index-id-error/

Thanks again.