문제

Yii bootstrap widgets TbDatePicker not hiding after select a date.

<?php
 echo $form->labelEx($modelRenterStatus,'moving_date');
 $this->widget('bootstrap.widgets.TbDatePicker', array(
        'model' => $modelRenterStatus,
        'attribute' => 'moving_date',
        'options' => array(
            'size' => '10',         // textField size
            'maxlength' => '10',    // textField maxlength
            'autoclose' => true,
        ),
    ));
?>

what's wrong with my this code?

도움이 되었습니까?

해결책

According to YB Docs Options are

options for the original library. This value will be JSON-encoded and fed to bootstrap-datepicker

And looking into library docs here I can't see the options you have put and so they are invalid.

Taking example from YB site

$this->widget(
    'bootstrap.widgets.TbDatePicker',
    array(
    'name' => 'some_date_jap',
    'options' => array(
    'language' => 'ja'
    ))
 );

language is option in original library. So recheck it again!

Just to expand my answer here is one that works with my form

<?php 
echo $form->datepickerRow($model, 'mode_attribute_here',array('hint'=>'',
                                            'prepend'=>'<i class="icon-calendar"></i>',
                                            'options'=>array('format' => 'yyyy-mm-dd' , 'weekStart'=> 1)
)); ?>

다른 팁

maybe it help others!! More detail here

<?php
 echo $form->labelEx($modelRenterStatus,'moving_date');
  $this->widget('bootstrap.widgets.TbDatePicker', array(
    'model' => $modelRenterStatus,
    'attribute' => 'moving_date',
    'options' => array(
        'size' => '10',         // textField size
        'maxlength' => '10',    // textField maxlength
        'autoclose' => true,
    ),
  ));
?>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top