datepicker in editable field

Hi,

I’m using the editablegrid extension. After doing some minor changes I’m able to edit fields and update them in the grid view. I’m now trying to use a datepicker to make the input of dates mor comfortable. Is it possible to add something like the SCalendar extension to a GridView?

I have a new class CDateColumn which extends CGridColumn I thought I needed something like


protected function renderDataCellContent($row,$data)

{

    $field = $this->name;

		

    printf('<input style="width:100%%" name="%s[%s]" type="text" value="%s" />', $data->tableSchema->name, $field, $data->$field);

    printf('<button id="trigger">Button</button>');

    $this->widget('application.extensions.calendar.SCalendar',

        array(

        'inputField'=>$field,

        'ifFormat'=>'%Y-%m-%d',

    ));

}

but it doesn’t work since I can’t use widgets in my CDateColumn. Does anyone have any ideas how to achieve that? :unsure:

schlydi

Bump! I am trying to figure out how to render a widget in a CDateColumn/CDataColumn. Any luck? Suggestions? Thanks.

Widget is a method of controller, not of CGridView.

Fortunately in CGridView there is the property owner, that returns the actual controller.

So just do:





protected function renderDataCellContent($row,$data)

{

    $field = $this->name;

                

    printf('<input style="width:100%%" name="%s[%s]" type="text" value="%s" />', $data->tableSchema->name, $field, $data->$field);

    printf('<button id="trigger">Button</button>');

    $this->owner->widget('application.extensions.calendar.SCalendar',

        array(

        'inputField'=>$field,

        'ifFormat'=>'%Y-%m-%d',

    ));

}