I modified CListView's html code, so rows could be updated, deleted and more rows could be added. (used inputs + ajaxbuttons) After each deletion or addition I updated the content of the list. I managed to give each button an unique id this way:

The problem was, that when I updated list content the <script> tags were removed via the jquery functions. You cannot add/modifiy <script> tags via JQuery, only hardcoded style. You have to get it as a string and eval() it.

So, after refresh you would have to "reassign" JQuery delegates, because the ids could have been modified, assigned to other objects:

I could try to examine the right <script> tag's content and eval it, so it always becomes updated.

By the way the same kind of thing happens if you have custom buttons in CGridView. When you paginate through ajax, and change page, you have to reassign the events attached to the "new" buttons loaded via ajax. Otherwise it doesnt work.

I too am having this extremely frustrating problem. @intel352's patch #1961 works if one is generating the script in the ajax response. BUT if the ajax response uses a zii widget which relies on jQuery, it does not work. I applied the CClientScript patch from #1961, then did:

But without renderScriptFiles = false, then after I close the dialog, ajax elements that were already present in the page no longer work. I get "jQuery.yii is undefined". Specifically, I have a "Cancel" button which was rendered in the original view, like this:

jQuery is already present in the main view, because I've used CHtml::SubmitButton() and CHtml::resetButton(). Explicitly registering jquery.js and jquery.yii.js at the top of the _form.php does not help; nor does doing this in my main.php layout.

Maybe I should have mentioned this is all CRUD-generated code (very simple form) using CActiveForm widget.

Also tried @zaccaria's solution, which works, but as others pointed out it also blocks the css for the CJuiWidget.

{EDIT}: <duh> the solution in my case was much simpler. before rendering the widget in my partial view, I do:

worked around it by using patch #1961, plus loaded jquery-ui in my main layout. I'm not crazy about this solution, and hoping for an improvement. Maybe patching the widgets per post 12697, and then using scriptMap to exclude jquery.js from loading again ?

I'm trying to load a CJuiDialog from an external view with the ZController render function but it seems that it doesn't load the requested jquery javascript files and css. How can I do that?? Should I use some specific function inside the view??

The solution is to cascade the inheritance, so ZController extends RController, which extends CController; or the other way around if it seems better. I am not familiar with the Rights module so I don't know which order the extension will work best.

ClaCS, on 16 March 2011 - 07:40 AM, said:

Hi!

I can't extend 'components/Contoller.php' to ZController because I'm using the new version of 'Rights' module and the components/Contoller.php' extends to RController

The solution is to cascade the inheritance, so ZController extends RController, which extends CController; or the other way around if it seems better. I am not familiar with the Rights module so I don't know which order the extension will work best.

Hi!

the cascade inheritance is works! but the ajax+clientScript problem is still

Thanks so much for this solutions. With my implementation, the CJuiDialog worked only on the 1st click (after) page rendered, now when I close the dialog and click on the open dialog link again, it gave a $().dialog('open') not defined error.

I got it to work with your solutions plus I also added the CSS files for the widget with this code: