Yii:datePicker没有在GridView上加载

时间:2014-02-26 12:44:41

标签: javascript php gridview yii datepicker

我正在尝试使用gridviewdatePicker

页面加载后,我使用datePicker,它完成了它的工作;

如果我尝试重用它,没有刷新,它就不起作用;它没有弹出;

任何想法为什么?

<div id="orderdiv">
                <?php
                $this->widget('zii.widgets.grid.CGridView', array(
                    'id' => 'orders-grid',
                    'dataProvider' => $model->search(),
                    'filter' => $model,
                    'ajaxUrl' => Yii::app()->baseUrl . '/orders/admin',
                    'ajaxUpdate' => 'orders-grid',
                    'tagName' => 'table',
                    'itemsCssClass' => 'items table table-striped table-hover',
                    'htmlOptions' => array(
                        'class' => 'table',
                        'style' => 'width:auto;',
                        'align' => 'left',
                    ),
                    'cssFile' => Yii::app()->baseUrl . '/css/custom.css',
                    'template' =>
//                '<tr><td style="border-top:none;height:74px;">{pager}</td></tr>' .
//                '<tr><td style="height:34px;border-top:none;">{summary}</td></tr>' .
                    '<tr><td style="border-top:none;">{items}</td></tr>' .
                    '<tr><td style="border-top:none;">{summary}</td></tr>' .
                    '<tr><td style="border-top:none;height:74px;">{pager}</td></tr>',
                    'columns' => array(
                        array(
                            'header' => 'Order ID',
                            'name' => 'id',
                            'type' => 'raw',
                            'value' => 'CHtml::link(str_pad($data->id, 9, "0", STR_PAD_LEFT),array("update","id"=>$data->id))',
                        ),
                        array(
                            'header' => 'Name',
                            'name' => 'var_user_full_name',
                            'value' => '$data->UserFullName',
                            'filter' => CHtml::activeTextField($model, 'var_user_full_name'),
                        ),
                        array(
                            'name' => 'total_price',
                            'type' => 'raw',
                            'value' => 'CurrencyData::$_currency[$data->currency]." ".$data->total_price',
                        ),
                        array(
                            'name' => 'created',
                            'value' => 'date("d/m/Y",$data->created)',
                            'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                                'model' => $model,
                                'attribute' => 'created',
                                'language' => 'en-AU',
//                            'i18nScriptFile' => 'jquery.ui.datepicker-en.js',
                                'htmlOptions' => array(
                                    'id' => 'created',
                                    'size' => '10',
                                ),
                                'defaultOptions' => array(
                                    'showOn' => 'focus',
                                    'dateFormat' => 'dd/mm/yy',
                                    'showOtherMonths' => true,
                                    'selectOtherMonths' => true,
                                    'changeMonth' => true,
                                    'changeYear' => true,
                                    'showButtonPanel' => true,
                                )
                                    ), true),
                        ),
                        array(
                            'name' => 'active',
                            'header' => 'Status',
                            'value' => 'OrdersData::$active[$data->active]',
                            'filter' => CHtml::activeDropDownList($model, 'active', OrdersData::$active, array('prompt' => '-Select-')),
                        ),
                        array(
                            'class' => 'CButtonColumn',
                            'header' => 'Action',
                            'template' => '{update}',
                        ),
                    ),
                ));
                ?>
            </div>

1 个答案:

答案 0 :(得分:0)

我在新的YII安装上有这段代码

<div id="orderdiv">
                <?php
                $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                                //'model' => $model,
                                'name'=>'test',
                                'attribute' => 'created',
                                'language' => 'en-AU',
//                            'i18nScriptFile' => 'jquery.ui.datepicker-en.js',
                                'htmlOptions' => array(
                                    'id' => 'created',
                                    'size' => '10',
                                ),
                                'defaultOptions' => array(
                                    //'showOn' => 'focus',
                                    'dateFormat' => 'dd/mm/yy',
                                    'showOtherMonths' => true,
                                    'selectOtherMonths' => true,
                                    'changeMonth' => true,
                                    'changeYear' => true,
                                    'showButtonPanel' => true,
                                )
                                    ));
                ?>
            </div>

效果很好...... 你的日期选择器是否单独运作?