This is very simple, but I could not find the answer, so please help. In my gridview, I added a custom column that changed the column header, and the filter does not work. It returned error on some column, and if one column worked, then the custom column showed nothing.
check whether the password column is safe on search scenario in you model’s rules() and moreover check whether the password column is used for searching in your model’s search() method
thank you for your reply. I think this is simple with just adding the column with custom header, but looks like the ajax call giving error.
this is the search function in model, again, it is by default
public function search()
{
// @todo Please modify the following code to remove attributes that should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id);
$criteria->compare('username',$this->username,true);
$criteria->compare('password',$this->password,true);
$criteria->compare('usertype_id',$this->usertype_id);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
And, even I remove the default password column, it still gives error. This is the link that gave error
And it does not matter which field, I take this model because it is short and easy to look at. The error in yii pop up window shows "Use of Undefined Constant"
This is the error that yii popped up when doing a search on the username field. If do search on other fields, it works with blank username (no data fill in that username field)
so whatever you entered in that text box is send as property to the yii and yii tries to find it. due to unavailable of such attribute in the model it throws an exception this is what happened for you I think
Yes, it looks like that in the error message. But if you look at the url sent by ajax, the "prop" string is the value of password field. So, I just wonder why it turned out to be something else.
Thank you all for your time. I think I found the solution, eventhough not fully understand it yet. I found this document in Yii gridview about header name
change the column header
If you want to change the column header in your grid view:
array( // display 'category.name' using an 'Category' as header
'name'=>'category.name',
'header'=>'Category',
),