filters with jquery for gridview

Hi I tested out a customized datacolumn which uses the CJuiDatePicker instead of the Dropdown or Inputfield as the filter input field.

The 1st rendering works like it should but after the ajax update the datepicker doesn’t open any more cause the jquery onclick isn’t binded any more to the input field.

Is there any possibility to extend the gridfield so that the js genereated from the widget and its filters is also used when the html from the ajax is replaced?

The only thing I need is to call


after the ajax refresh so the datepicker is working again.

If the content is refreshed you will need to bing the event with the ‘live’ function. Read more about the .live at the Jquery documentation site. Regardless of this error i think there should be a property implemented into the CGridView that will attache the events with/without the live function.

I know the "live" function and already tested it with the datepicker.

Sadly no event like ready or load works for the calendar creation and with the on click event the datepicker takes too long for creation so you have to wait several seconds or click multiple times till the datepicker appears.

Do someone know how the afterAjaxUpdate Property works and if the jquery code of the filters and additional js code be handled via this?

the best thing would be if the gridview gets the js code of the used elements itself and process them after ajaxupdate. like it would normaly be done on a normal page refresh.

I found a solution which works manually.

if i knew the generated js code, i can to add the code to the gridview:

‘afterAjaxUpdate’ => ‘js:function(id, data) {jQuery("#updated").datepicker({“showAnim”:“clip”,“dateFormat”:“yy-mm-dd”})}’,

But it would be nice if the gridview would add those js code automatically for its containing elements like filters.

Is there any way to get the script code of a selected widget from the Yii::app Clientscript?

Or from the rendered html code from the ajax update?

e.g. get a specific part of the html code which contains the js code from the grid?