If the CJuiDatePicker component is used in the ajax update interface, please note that you need to re-execute the jquery ui datepicker JS initialization script for the date control to take effect.
In addition, the datepicker control depends on the jQuery UI plug-in, so the CSS and JS files of jquery ui need to be registered. The specific code is as follows:
<?php Yii::app()->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' ); ?>
$.ajax({ <span></span>url:'<?php echo $this->url?>', <span></span>type:'post', <span></span>data: '&days=' + days, <span></span>dataType:'text', <span></span>success:function(data){ <span></span> $("#list").html(data); <span></span> $('#begin_time').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['cn'],{'dateFormat':'yy/mm/dd'})); <span></span>} });
The above introduces Yii: using the CJuiDatePicker date control in ajax refresh, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.