Yii Framework Forum: Global Registration Of Gridview.js Etc. - Yii Framework Forum

Jump to content

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

Global Registration Of Gridview.js Etc. Rate Topic: -----

#1 User is offline   Glapa 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 02-August 13

Posted 22 October 2013 - 02:34 PM

Hi!

I'm building AJAX driven application with Yii and during each AJAX response with one of the widgets browsers asynchronously download script file for them. I wonder if it is possible to register all necessary scripts like activeform, gridview at first request to the site?
0

#2 User is offline   nineinchnick 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 622
  • Joined: 12-September 11
  • Location:Bialystok, Poland

Posted 22 October 2013 - 04:34 PM

I don't know any mechanism that would keep track of scripts already loaded in a single browser tab so subsequent ajax calls would not register them again. It would require to generate some kind of token when rendering the non-ajax view and passing it to each ajax call.
Since building such extension is not trivial currently I resolve to manually registering all required scripts in the non-ajax action and clearing all automatically registered scripts and core scripts in actions called through ajax.
Don't be a dick.
0

#3 User is offline   Glapa 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 02-August 13

Posted 23 October 2013 - 02:17 AM

It's what I exactly want to do but I don't know how to register them manually since they have to be published by widget.
0

#4 User is offline   nineinchnick 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 622
  • Joined: 12-September 11
  • Location:Bialystok, Poland

Posted 23 October 2013 - 10:05 AM

You could call the widget as if in the ajax action and discard it's output.
Don't be a dick.
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