Using Cjuidatepicker For Cgridview Filter


I followed this example: Post

It works the first time, but if after selecting a date I want to choose another date (clcking on filter textbox), the datepicker is not shown again.

Any ideas? Do I have to add a jQuery such as $(’#my_datepicker_textbox’).click(function(){… to reload?



Yes you have to use jquery to load it again

add below code in your admin.php file

replace the datefield with your field

'afterAjaxUpdate'=>"function(){jQuery('#datefield').datepicker({'dateFormat': 'yy-mm-dd'})}",  

Great! thank you very much!

where should I place the code? Im a newbie, sorry. Thanks!

Hi. I’ve used it like this:

$this->widget('zii.widgets.grid.CGridView', array(






							$('#datepicker_id').datepicker({'dateFormat': 'yy-mm-dd'});







I hope it helps!