Yii Framework Forum: CListView incorrect summary info - Yii Framework Forum

Jump to content

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

CListView incorrect summary info Rate Topic: -----

#1 User is offline   imehesz 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 709
  • Joined: 13-June 09
  • Location:Jacksonville, FL

Posted 25 March 2010 - 08:12 PM

hello guys,

I recently made the big step and started to play with the latest 1.1.1 branch. It's definitely different than the 1.0.x ;)

So, I'm trying to use the magnificent CListView Zii widget with the following model/controller setup ...

// some action
...
        $criteria = new CDbCriteria();
        $criteria->group = 'title';
        $criteria->order = 'created DESC';

		$dataProvider=new CActiveDataProvider('Somemodel', array(
			'pagination'=>array(
				'pageSize'=>self::PAGE_SIZE,
			),
                        'criteria' => $criteria,
		));

		$this->render('index',array(
			'dataProvider'=>$dataProvider,
		));
...


As you can see, I'm grouping on the TITLE field. It works exactly as expected, except the summary (and pagination part). It seems like the summary (and pagination) shows all the results without my grouping.

I'm most likely missed something (never went to the 1.1.1 school :) )

btw, my view looks like this:

...
<?php $this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$dataProvider,
	'itemView'=>'_view',
)); ?>
...


thanks for the help,

--iM
It’s done, the great act of creation.
The maker rests. The wheel’s in motion.
-- Imre Madách

check out Yii Theme Factory at http://yii.themefactory.net
0

#2 User is offline   imehesz 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 709
  • Joined: 13-June 09
  • Location:Jacksonville, FL

Posted 26 March 2010 - 01:00 PM

hello,

Turned on the logging and it's clearly showing something ...

Querying SQL: SELECT COUNT(*) FROM 'pages' 't'
in /var/www/yii-1.1.1.r1907/framework/zii/widgets/CBaseListView.php (99)
in /var/www/yii-1.1.1.r1907/framework/zii/widgets/CListView.php (151)
in /var/www/yiiki/protected/views/page/index.php (17)


...

Querying SQL: SELECT * FROM 'pages' 't' GROUP BY title ORDER BY created
DESC LIMIT 10
in /var/www/yii-1.1.1.r1907/framework/zii/widgets/CBaseListView.php (99)
in /var/www/yii-1.1.1.r1907/framework/zii/widgets/CListView.php (151)
in /var/www/yiiki/protected/views/page/index.php (17)


so the count is clearly off :/

--iM
It’s done, the great act of creation.
The maker rests. The wheel’s in motion.
-- Imre Madách

check out Yii Theme Factory at http://yii.themefactory.net
0

#3 User is offline   imehesz 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 709
  • Joined: 13-June 09
  • Location:Jacksonville, FL

Posted 27 March 2010 - 07:42 AM

hello,

So, I tried it many different ways but it's still not working.

Is there a way I can use the 1.0.x style pagination in 1.1.1?

thanks,
--iM
It’s done, the great act of creation.
The maker rests. The wheel’s in motion.
-- Imre Madách

check out Yii Theme Factory at http://yii.themefactory.net
0

#4 User is offline   M Wotton 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 01-November 09

Posted 29 March 2010 - 01:20 AM

View Postimehesz, on 27 March 2010 - 07:42 AM, said:

hello,

So, I tried it many different ways but it's still not working.

Is there a way I can use the 1.0.x style pagination in 1.1.1?

thanks,
--iM



This is problematic for me too, except I want to use a custom pager style. I have created a custom pager widget which has different CSS classes and IDs, and I would like to use those classes in the pager generated by the CActiveDataProvider instance.

Which reminds me of another problem... it's annoying that I have to add another URL rule every time I put a pager in a view to handle the new variable... I might have to create a new thread for that.
Micha Wotton
Posted Image
0

#5 User is offline   mech7 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 220
  • Joined: 26-March 09

Posted 11 May 2010 - 06:24 AM

Yes very annoying.. I prefer the old style? How to override the pager? It's all PHP and no clear way to override give me back my html :(
0

#6 User is offline   imehesz 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 709
  • Joined: 13-June 09
  • Location:Jacksonville, FL

Posted 11 May 2010 - 06:36 AM

View Postmech7, on 11 May 2010 - 06:24 AM, said:

Yes very annoying.. I prefer the old style? How to override the pager? It's all PHP and no clear way to override give me back my html :(


mech7,

we opened a ticket for this, please click on the STAR on it so the developers will know that it is needed ...

http://code.google.c...Stars%20Summary

--iM
It’s done, the great act of creation.
The maker rests. The wheel’s in motion.
-- Imre Madách

check out Yii Theme Factory at http://yii.themefactory.net
0

#7 User is offline   mech7 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 220
  • Joined: 26-March 09

Posted 11 May 2010 - 07:03 AM

Ah i see.. but I did not see anything about the template for the pager...

As far as i can see in the documentation there is a template:

<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
'pager'=> array('cssFile'=>false, 'header' => false),
'template' => '{pager}
<div class="clear"></div>
{summary}
{items}
<div class="clear"></div>
{pager}'
)); ?>

But how ugly is that? the reason i use mvc is to seperate my html from logic... I don't need / want to add another layer of complexity in my views.
0

#8 User is offline   mech7 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 220
  • Joined: 26-March 09

Posted 11 May 2010 - 07:04 AM

Ah i see.. but I did not see anything about the template for the pager...

As far as i can see in the documentation there is a template:

<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
'pager'=> array('cssFile'=>false, 'header' => false),
'template' => '{pager}
<div class="clear"></div>
{summary}
{items}
<div class="clear"></div>
{pager}'
)); ?>

But how ugly is that? the reason i use mvc is to seperate my html from logic... I don't need / want to add another layer of complexity in my views. let alone mixing html in php array's
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