Search Column Missing Input

In my zii.widgets.grid.CGridView theres a column which loads relational data "profile_rel.lastname",


'profile_rel'=>array(self::BELONGS_TO, 'Profiles', 'id_user'),

But the search input field is missing…

I tried adding profile_rel.lastname and also just profile_rel in to the Model rules() Search array, but it still doesnt show.

What am I doing missing?

This wiki article will help you.

http://www.yiiframework.com/wiki/281/searching-and-sorting-by-related-model-in-cgridview

Thank you,

I had this in my CGridView


array( 'name'=>'profile_rel.lastname', 'header'=>'Assigned', ),

Replaced with


array( 'name'=>'profile_rel', 'value'=>'$data->profile_rel->lastname' ),

Which gave me a search input!!

However, It’s labbled the column header to Profile Rel, and if I change it on the coe above, i get errors…

Ooooooooooh as I wrote that I had a ‘moment’ so added this on the end!!


array( 'name'=>'profile_rel', 'value'=>'$data->profile_rel->lastname','header'=>'Assigned' ),

Good work me, thanks me, couldnt have done it without softark lol

p

#EDIT#

Bum holes, if you enter a lastname, the form seems to think as I see the loader icon, but then the input is blanked, and nothign happens…

Also you cant click the header to sort…

So close, yet so far!

No you’re very close :) Just look again at the link softark gave you. Everything’s there ;)

You tease, im now doing the Puss-in-boots cat eyes from Shrek…

Well, I looked again, and added to my Models search, but get the feeling i need to create that other search function too, but now its getting all messing, so will look tomorrow… sniff


$criteria->with = array( 'profile_rel' );


        $criteria->compare( 'profile_rel.lastname', $this->#####, true );