Yii Framework Forum: filters with jquery for gridview - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

filters with jquery for gridview Rate Topic: -----

#1 User is offline   horizons 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 119
  • Joined: 18-December 08

Posted 15 April 2010 - 02:54 AM

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
"$('#myid').datepicker({'showAnim':'clip','dateFormat':'yy-mm-dd'});
after the ajax refresh so the datepicker is working again.
0

#2 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 16 April 2010 - 01:56 AM

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.
Vince Gabriel, Lead Developer.
Posted ImagePosted ImagePosted Image
0

#3 User is offline   horizons 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 119
  • Joined: 18-December 08

Posted 16 April 2010 - 02:23 AM

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.
0

#4 User is offline   horizons 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 119
  • Joined: 18-December 08

Posted 16 April 2010 - 07:42 AM

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?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users