Использую CGridView и CButtonColumn для кнопочек. Все стандартное.
Появилась задача. В CGridView (точнее у CButtonColumn) есть кнопка ‘Удалить’ у каждой строки. При клике на кнопку удаляется соответствующая запись (модель) в БД. GridView обновляется после этого используя Ajax (вся страница целиком не обновляется). Как мне вывести какие-либо сообщения об успешности удаления или наоборот ошибочные сообщения после клика на кнопку ‘Удалить’?
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'afterAjaxUpdate' = 'mycoolfunc',
'columns'=>array(
'title', // display the 'title' attribute
'category.name', // display the 'name' attribute of the 'category' relation
'content:html', // display the 'content' attribute as purified HTML
array( // display 'create_time' using an expression
'name'=>'create_time',
'value'=>'date("M j, Y", $data->create_time)',
),
array( // display 'author.username' using an expression
'name'=>'authorName',
'value'=>'$data->author->username',
),
array( // display a column with "view", "update" and "delete" buttons
'class'=>'CButtonColumn',
),
),
));
?>
<script type="text/javascript">
function mycoolfunc(id, data) {
// something what you need
}
</script>