yii 1自定义小部件中的CJuiDatePicker

时间:2016-07-14 12:48:58

标签: php yii yii-widgets

我像这样创建新的svn log --search FOO --search-and BAR

widget
这个class Schedule extends CWidget { public $address = null; public $order = null;//order public function init() { if(isset($this->order)) $this->address = $this->order->address; } public function run() { $city = City::model()->findAll(array('condition'=>'is_active = 1','order'=>'name ASC')); $this->render('my_schedule',array('city'=>$city)); } }

view

widget

在这种情况下,日历无法打开,但是当我在简单视图中使用<?php $form = new CActiveForm(); $form->id = 'checkout-form'; $form->enableAjaxValidation = true; $form->clientOptions = array( 'validateOnSubmit' => true, 'validateOnChange' => false); $order->address = $address; ?> <?php if(is_array($city) && count($city) > 0) : ?> <section class="persent70"> <p> <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array( 'model'=>$order, 'attribute'=>'delivery', 'name'=>'delivery', 'options'=>array( 'showAnim'=>'slide', 'htmlOptions'=>array( 'class'=>'form-control', 'id' => 'delivery', ), )); ?> <?php echo $form->error($order, 'delivery'); ?> </p> 时,此CJuiDatePicker工作正常。

1 个答案:

答案 0 :(得分:0)

尝试使用$this->getController()->widget('zii.widgets.jui.CJuiDatePicker', array(....));