0

問題:アプリケーションに2つ以上の日付ピッカーがあります。それらはidと名前で定義されます。そして、それらの日付設定は同じであってはなりません。

たとえば、為替レートの日付は今日の日付のみにする必要があります。また、ETAの完了日は今日の日付であってはなりません。

$this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'name'=>'Request[exchange_date]',       
                'model'=>$model,
                'value' => $model->exchange_date,
                'i18nScriptFile' => 'jquery.ui.datepicker-ja.js', // (#2)
                'htmlOptions' => array(
                    'id' => 'Request_exchange_date',
                    'size' => '10',
                ),
                'defaultOptions' => array(  // (#3)
                    'showOn' => 'focus', 
                    'dateFormat' => 'dd-M-yy',
                    'showOtherMonths' => true,
                    'selectOtherMonths' => true,
                    'changeMonth' => true,
                    'changeYear' => true,
                    'showButtonPanel' => true,
                    'yearRange'=>'0:+1', 
                    //'minDate'=> 0,
                )
            ));

$this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'name'=>'Request[eta_date]',        
                'model'=>$model,
                'value' => $model->eta_date,
                'i18nScriptFile' => 'jquery.ui.datepicker-ja.js', // (#2)
                'htmlOptions' => array(
                    'id' => 'Request_eta_date',
                    'size' => '10',
                ),
                'defaultOptions' => array(  // (#3)
                    'showOn' => 'focus', 
                    'dateFormat' => 'dd-M-yy',
                    'showOtherMonths' => true,
                    'selectOtherMonths' => true,
                    'changeMonth' => true,
                    'changeYear' => true,
                    'showButtonPanel' => true,
                    'yearRange'=>'0:+1', 
                    'minDate'=> 0,
                )
            ));

Q:単一のフォームで異なる日付ピッカーに異なる設定を設定するにはどうすればよいですか?

4

1 に答える 1

0

CJuiDatePicker の使用中は、「defaultOptions」ではなく「options」を設定する必要があると思います。「defaultOptions」を使用すると、日付ピッカーの他のすべてのインスタンスが同じように動作するようになります。

于 2012-10-24T18:27:25.310 に答える