以下はview.phpファイルの私のコードです
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'myGrid',
'dataProvider' => $model->search(),
'filter' => $model,
'enableSorting' => true,
'columns' => array(
array(
'name' => 'id',
'header' => 'ID',
'value' => $data->id,
),
array(
'header' => 'Value',
'value' => '$data->getValue($data->id)', //getValue($id) is a custom method in the model.php file which returns a value after some calculations
'filter' => $model->listOfFilterValues(), //listOfFilterValues() is a custom method in the model.php file which returns a CHtml::listData
),
),
)
);
ご覧のとおり、model.php ファイルでカスタム メソッドを使用して Value 列を取得しています (クエリから取得できないため)。gridView が表示され、ドロップダウン リストが表示されます。今まで正常に動作します。
問題は、ドロップダウン ([値] 列) を使用したフィルタリングが機能しないことです。(クエリ出力の列ではないため)また、値列(列ヘッダーをクリックしたとき)の並べ替えも機能しません。
これを行う方法はありますか?あなたの助けは非常に高く評価されています。ありがとうございました。