January 18, 2010, 11:55am
the CGridview all the data,I don’t want to show all the data ,i want show some data with condition,like survey_id = 1,how can i do that?
<?php $this->widget('zii.widgets.grid.CGridView', array(
January 18, 2010, 1:25pm
You should do this with the data provider, not grid view:
$dataProvider=new CActiveDataProvider('ModelClass', array(
January 19, 2010, 2:31pm
by the way ,how to show some data with condition in relation model when use CGridview?
January 19, 2010, 5:10pm
That can be similarly done except that you also need to specify the ‘with’ option in the query criteria.
January 29, 2010, 9:38pm
Does this also work with MANY_MANY relations?
$criteria = new CDbCriteria;
$criteria->with = array('categories') // categories is a MANY_MANY related model
$criteria->condition = array('categories = 54') // <-- want to display every ROW that has the category 54
is this possible to add some MANY_MANY intelligent logic to the CDbCriteria like this ? thank you !
January 30, 2010, 12:50pm
Yesterday I asked about this on russian forum… but I didn’t heard any answers.
I solve this in… IMHO very ugly way.
I use some additional model attributes and handful of subqueries.
Currently I try to find more elegant solution
December 13, 2015, 11:47pm
I think you should get a more extensive explanation. If still open to it please tell me