CJuiDatePicker en CGridview como campo de formulario

Estoy mostrando elementos de formulario en mi CGridView y me gustaría datepicker, pero se queja

CDataColumn and its behaviors do not have a method or closure named "widget". 

He modificado DATEIN utilizando el método descrito en Usar un widget en un método llamado de forma estática. Sin embargo, creo que funciona parcialmente, como cuando hago una clasificación o el selector de fecha no funciona. está trabajando solo en la carga inicial.

  $(document).ready(function() { /* $("input[name*='DATEIN'] ").each(function(){ jQuery(this).datepicker({'dateFormat':'params["localdate"]; ?>'}); }); */ $("input[name*='datedone'] ").each(function(){ jQuery(this).datepicker({'dateFormat':'params["localdate"]; ?>'}); }); });  createUrl('addNewLine',array("id"=>$model->id)), array( 'type' => 'POST', 'data' => array('id' => $model->id), 'success' => 'function(html){ $.fn.yiiGridView.update("jobs-grid"); $.fn.yiiGridView.update("detailsseismic-grid"); $.fn.yiiGridView.update("details3d-grid"); }' )); $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'jobs-grid', 'dataProvider'=>$job->searchbyproject($model->PROJID), 'afterAjaxUpdate'=>'function(id,options){ $("#jobs-grid").children("table").children("thead").children("tr").children("th").children("a").each(function(){ $(this).click(function(){ var x = getQueryParams(this.href); if($("#detailsgeoscan-grid").length) $.fn.yiiGridView.update("detailsgeoscan-grid",{data:"sort="+x.sort}); else if($("#detailsseismic-grid").length) $.fn.yiiGridView.update("detailsseismic-grid",{data:"sort="+x.sort}); else if($("#details3d-grid").length) $.fn.yiiGridView.update("details3d-grid",{data:"sort="+x.sort}); }); }); $("#jobs-grid").children("div").children("ul").children("li").children("a").each(function(){ $(this).click(function(){ var x = getQueryParams(this.href); if($("#detailsgeoscan-grid").length) $.fn.yiiGridView.update("detailsgeoscan-grid",{data:"Detailsgeoscan_page="+x.Jobs_page}); else if($("#detailsseismic-grid").length) $.fn.yiiGridView.update("detailsseismic-grid",{data:"Detailsseismic_page="+x.Jobs_page}); else if($("#details3d-grid").length) $.fn.yiiGridView.update("details3d-grid",{data:"Details3d_page="+x.Jobs_page}); }); }); /* $("input[name*=\'DATEIN\'] ").each(function(){ jQuery(this).datepicker({"dateFormat":"'. Yii::app()->params["localdate"]. '"}); }); */ $("input[name*=\'datedone\'] ").each(function(){ jQuery(this).datepicker({"dateFormat":"'. Yii::app()->params["localdate"].'"}); }); }', 'summaryText' => '', 'columns'=>array( array( 'name'=>'JOBNO', 'value'=>'CHtml::activeHiddenField($data, "[$row]JOBNO")' , 'type'=>'raw', 'headerHtmlOptions' => array('style' => 'display:none;'), 'htmlOptions' => array('style' => 'display:none'), 'footer' => $buttonPlus, 'footerHtmlOptions'=> array('colspan' => '7'), ), array( 'name'=>'NAME', 'value'=>'CHtml::activeTextField($data, "[$row]NAME", array("size"=>25))' , 'type'=>'raw', 'footerHtmlOptions'=> array('style' => 'display:none'), ), array( 'name'=>'SEQ', 'value'=>'CHtml::activeTextField($data, "[$row]SEQ", array("size"=>15))' , 'type'=>'raw', 'footerHtmlOptions'=> array('style' => 'display:none'), ), array( 'name'=>'DATEIN', //'value'=>'CHtml::activeTextField($data, "[$row]DATEIN", array("size"=>10))' , 'value' => function ($data, $row, $column) { $controller = $column->grid->owner; echo $controller->widget('zii.widgets.jui.CJuiDatePicker', array( 'model'=>$data, 'attribute'=>'DATEIN', // additional javascript options for the date picker plugin 'htmlOptions'=>array( 'class'=>'datefield', 'id' => 'Jobs_'.$row.'_DATEIN', ), 'options' => array( 'dateFormat' => Yii::app()->params["localdate"], ) ),true); }, 'type'=>'raw', 'footerHtmlOptions'=> array('style' => 'display:none'), ), array( 'header'=>"Process Complete 
$processcompleteheader
", 'value'=>'$data->getcheckboxProcesses($row)', 'type'=>'raw', 'footerHtmlOptions'=> array('style' => 'display:none'), ), array( 'name'=>'DATEDONE', 'value'=>'CHtml::activeTextField((count($data->jobsprocesscomplete)>0) ? $data->jobsprocesscomplete(array("order"=>"datedone desc")) : new Jobsprocesscomplete , "[$row]datedone", array("size"=>10))' , 'type'=>'raw', 'footerHtmlOptions'=> array('style' => 'display:none'), 'sortable' => false, ), array( 'name'=>'COMMENTS', 'value'=>'CHtml::activeTextField($data, "[$row]COMMENTS", array("style"=>"width:150px"))' , 'type'=>'raw', 'footerHtmlOptions'=> array('style' => 'display:none'), ), array( 'header'=>'X', 'class'=>'CButtonColumn', 'template'=>'{delete}', 'footerHtmlOptions'=> array('style' => 'display:none'), ), ), )); ?>

Lo renderizo desde otra vista

 $processcompleteheader = null; foreach ($processstages as $k => $v) { $processcompleteheader .= CHtml::Checkbox($k."_all",'',array("value"=>$k,"title"=>$v)); } $lineListContent = "
" .CHtml::hiddenField("PROJID",$model->PROJID) . CHtml::hiddenField("id",$model->id) . CHtml::activeFileField(new Fileupload,'jobs', array('onChange'=>'showLoadDialog();submit(this)'))."X
"; $lineListContent .= $this->renderPartial("/jobs/_formJobsGridview",array("model"=>$model,"processcompleteheader"=>$processcompleteheader),true); $lineListContent .= "
";

Creo que esta pregunta aquí puede ayudarte:

Use un widget en un método llamado de forma estática

Básicamente, este widget puede ser llamado por el controlador, pero en su código usted está tratando de llamarlo por gridview.

    Intereting Posts