Yii Framework Forum: Yii Grid Using Cformmodel - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii Grid Using Cformmodel Grid Rate Topic: -----

#1 User is offline   jr_jags 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 05-November 12
  • Location:Philippines

Posted 17 January 2013 - 07:48 AM

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?
0

#2 User is offline   kokomo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 289
  • Joined: 23-July 10

Posted 17 January 2013 - 08:28 AM

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 Posted Image?
0

#3 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,085
  • Joined: 16-February 11
  • Location:Japan

Posted 17 January 2013 - 08:43 AM

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.
0

#4 User is offline   jr_jags 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 05-November 12
  • Location:Philippines

Posted 17 January 2013 - 09:24 AM

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.yiiframew...index-id-error/


Thanks again.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users