Global Registration Of Gridview.js Etc.

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?

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.

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.

You could call the widget as if in the ajax action and discard it’s output.