If the Cjuidatepicker component is used in the Ajax update interface, note that the jquery UI DatePicker JS initialization script needs to be re-executed for the date control to take effect.
In addition, the DatePicker control relies on the jquery UI plug-in, so you need to register the jquery ui css and JS files. The specific code is as follows:
Getclientscript ()->registercorescript (' jquery '); Yii::app ()->getclientscript ()->registercorescript (' Jquery.ui '); Yii::app ()->clientscript->registercssfile ( Yii::app ()->clientscript->getcorescripturl (). /jui/css/base/jquery-ui.css ' ); Yii::app ()->clientscript->registercssfile ( Yii::app ()->clientscript->getcorescripturl (). /jui/css/base/jquery.ui.datepicker.css ' ); ? >
Reinstall the date control initialization script:
$.ajax ({URL: '
url?> ',type: ' Post ',data: ' &days= ' + days, DataType: ' text ',success:function (data) { $ ("#list"). HTML (data); $ (' #begin_time '). DatePicker (Jquery.extend ({showmonthafteryear:false}, Jquery.datepicker.regional[' cn '],{' DateFormat ': ' Yy/mm/dd '}); }});
If you are using a date control in Cgridview, you can put the reinitialized operation in the Afterajaxupdate callback.
The above describes Yii: using the Cjuidatepicker date control in Ajax refresh, including the content of the aspects, I hope that the PHP tutorial interested in a friend helpful.