Yii Framework Forum: CGridView is way too limited. - Yii Framework Forum

Jump to content

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

CGridView is way too limited. Rate Topic: -----

#1 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 28 February 2010 - 08:04 AM

Hi,

I went through the CGridView documentation and i saw that it is limited to an AR object only. What if i have an array i would like to sort it with? I am pretty sure that the same functionality can be done using an array with some small modification.

Did anyone found something or can say how to use the CGridView without an AR object but an array?

Thanks.
Vince Gabriel, Lead Developer.
Posted ImagePosted ImagePosted Image
0

#2 User is offline   Y!! 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 978
  • Joined: 18-June 09

Posted 28 February 2010 - 08:15 AM

Quote

CGridView should be used together with a data provider, preferrably a CActiveDataProvider.


I think you can use CDataProvider to work with pure arrays for example.
0

#3 User is offline   qwerty 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 290
  • Joined: 20-November 08

Posted 28 February 2010 - 08:17 AM

Try this extension
0

#4 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 28 February 2010 - 08:20 AM

I did and it does work, But for some reason it won't show the paginate links, Despite the fact that it does limit the grid to just 20 rows out of the 100 i have, it won't sort using the headers as the CSort uses an AR as well.
Vince Gabriel, Lead Developer.
Posted ImagePosted ImagePosted Image
0

#5 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 28 February 2010 - 09:24 AM

Ok, Managed to figure everything out. Now how can i make it that the pager links will use AJAX isntead of refreshing the page?

Thanks.

MY code:

$this->widget('zii.widgets.grid.CGridView', array(
                    'dataProvider'=>$data_provider,
                    'columns'=>$store,
                    'ajaxUpdate' => 'results-query',
                    'nullDisplay' => '--',
                    'pager' => array('pageSize'=>20, 'maxButtonCount'=>10, 'actionPrefix' => 'LoadQuery'),
                    'rowCssClass'=> array('acp-row-on', 'acp-row-off'),

            ));

Vince Gabriel, Lead Developer.
Posted ImagePosted ImagePosted Image
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