Reputation: 1222
I'm using Yii 1.x framework.I have a booster TbGridView table,in some cell I added some widget like select2
and datetimepicker
to make it more practical and look better,at the same time I also added a filter at the top of the table.But after used filter,I found the js code that initialize widget not to be used.In HTML code that had generated I found the js code was added at the bottom of page,when I used filter,it's just fresh the table with ajax,so the js code at the bottom was not be used.So,what's the solution at this time.Anybody can help me?please.
Upvotes: 0
Views: 136
Reputation: 26
You can use afterAjaxUpdate
.
$this->widget('zii.widgets.grid.CGridView', array(
'afterAjaxUpdate' => 'reinstallDatePicker',
...
);
Yii::app()->clientScript->registerScript('re-install-date-picker', "function reinstallDatePicker(id, data) {}");
http://www.yiiframework.com/wiki/318/using-cjuidatepicker-for-cgridview-filter/
Upvotes: 1