CGridView filter search

Hi,

I need filter in varchar column with start filter LIKE ‘aaa%’ not default ‘%aaa%’. I found topic http://www.yiiframework.com/forum/index.php?/topic/17119-cgridview-filter-search/ but it not work for me, I see empty table with ‘no results’ any suggestions? I use 1.1.8.

S

Post your code… how do you make the search?

irc channel solution that works perfectly

standard CRUD code


$criteria->compare('name',$this->name);

replaced with


$keyword = strtr($this->name, array('%' => '\%', '_' => '\_', '\\' => '\\\\'));

$criteria->addSearchCondition(

			'name',

			$keyword . '%',

			false );

thank you SJFriedl :)

S