Yii Framework Forum: Using Cjuidatepicker For Cgridview Filter - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Using Cjuidatepicker For Cgridview Filter Rate Topic: -----

#1 User is offline   martinirojo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 06-October 12

Posted 03 November 2012 - 10:05 AM

Hi!
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?

Thanks!
0

#2 User is offline   sanjay1024 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 06-October 12

Posted 03 November 2012 - 12:06 PM

Hi,

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'})}",  

0

#3 User is offline   martinirojo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 06-October 12

Posted 05 November 2012 - 05:04 PM

View Postsanjay1024, on 03 November 2012 - 12:06 PM, said:

Hi,

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!
0

#4 User is offline   Neil Bardos 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 16-November 12

Posted 16 November 2012 - 03:58 AM

View Postsanjay1024, on 03 November 2012 - 12:06 PM, said:

Hi,

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'})}",  



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

#5 User is offline   martinirojo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 06-October 12

Posted 17 November 2012 - 06:24 AM

View PostNeil Bardos, on 16 November 2012 - 03:58 AM, said:

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(
    'id'=>'ticketGridId',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
	'afterAjaxUpdate'=>"function(){
							$.datepicker.setDefaults($.datepicker.regional['en']);
							$('#datepicker_id').datepicker({'dateFormat': 'yy-mm-dd'});
							
						}", 	
	
    'columns'=>array(
		'idTicket',
...


I hope it helps!
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users