Once I have tried to make it based on this wiki, unfortunately it was absolutely not working for me, I couldn’t figure out why. I’m not sure right now is it only for filtering one single corresponding field or any other fields.
I don’t really understand why is this not working like so:
- defined in model one of the related models’ attributes:
- put into search() function the following:
array('... relation.relatedAttribute', 'safe', 'on' => 'search'),
array('... relatedAttribute', 'safe', 'on' => 'search'),
no change in ‘not-working’ state.
it should work like so, shouldn’t it?
this is the only thing I haven’t put into my code:
return new CActiveDataProvider( 'Post', array(
because I thought I don’t need this sorting capability. or do I have to put it there anyway?
once I could make it based on Hollyii’s Yii Blog article, but I can’t find right now which model it was…
I don’t know why, but there was even absolutely no textfield in the header of the grid, I thought I have to put there one:
'name' => 'relation.relatedAttribute',
'header' => 'relatedAttribute',
'value' => '$data->relation->relatedAttribute',
'filter' => CHtml::textField('relatedAttribute'),
but still not working.
can the problem be that I’m using bootstrap? but I could make it once and it was also bootstrap…
now, if I do this:
'name' => 'relatedAttribute', ...
the textfield appears on the top of the grid. but still no filtering.
array('... , relatedAttribute', 'safe', 'on' => 'search'),
it’s not allowed to put ‘relation.’ in front of variable in grid and in relations.