Model default value interfering with sorting in GridView


I have a default value in my model set using the init function

     public function init() {

        $this->reg_date = date('Y-m-d');


This works great but I noticed that when I sort my GridView widget it’ll include today’s date as a condition in the query like this

WHERE `reg_date` LIKE '%2014-10-19%' 

I guess I’m not setting the default value in the appropriate way since it appears to interfere with Searching and Sorting?

you probably have Model and ModelSearch which extends Model. So if method init() is in Model you need alter it in ModelSearch

public function init()



    $this->reg_date = null;