ajaxSubmitButton, ajaxButton, and nested CJui widgets not working

I’ve got a CJuiTabs with ajax links in the headers, which call controller actions by ajax and partially render a form underneath.

Unfortunately, I can’t use CJuiAccordion inside the CJuiTabs in this arrangement; and I just noticed that none of my ajax links or buttons work either inside this tab arrangement. Does anybody have any idea why this would be?

ajax link are quite fragile, they can have some problems because the js code is not embedded in the tag, but is attached to them using the id.

Checking the code of a page, you can see how all ajax lika are just tag a with an id like #yt1, and in the bottom of the page there is smth like:




Query('#yt1').live('click',function(){jQuery.yii.submitForm ...



That system sometime has problem, expecially when link are in some response.

If an ajax link have to me refreshed by an ajax request, I usually create ajax link like that:




return CHtml::link(

	$label,

	'',

	array(

		'onClick'=>CHtml::ajax(array

		(

			'url'=>$url,

			'update'=>$div,

			'type'=>'POST',

						

		)), 

		'style'=>"cursor:pointer;"

	)

);




Like that there are no id that can be ambiguous, it generate a tag with embedded his code. This kind of like always work, even after ajax request.

That does the trick, thanks! It adds that bit of code bloat though… I wish it didn’t have to work like this :(

Actually is a bit strange, because the default is “sort all field of the table” and if you don’t want the default, the only alternative is “if you don’t like my way, do all on your own”…

That’s not a bad philosophy, but maybe to have the possibility of write something “sort all field of the table plus this one” should be nice.

For now you should do all on your own.