loading CTabView via Ajax

Hey guys

Im trieing to load a complete CTabView via Ajax into my site for some administration stuff.

The relevant part of the view im loading in looks like this:




CHtml::ajaxLink(CHtml::encode($data->value), array("ajax/getLanguageGridView&s=".$data->value),

array("success"=>"function(data, textStatus, jqXHR) {


while(document.getElementById(\"languageGridView\").firstChild)

{							

	var contentNode = document.getElementById(\"languageGridView\");

	contentNode.removeChild(contentNode.firstChild);

}


var div = document.createElement(\"div\");

div.innerHTML = data;

var docFrag = document.createDocumentFragment();

while(div.firstChild)

	docFrag.appendChild(div.firstChild);


document.getElementById(\"languageGridView\").appendChild(docFrag);

														}",

)

)



As you can see its just cut out of the rest, but the reason i show you is just the javascriptpart since it might be useful to see. It does what i want i guess.

More interesting might be the AjaxController:




foreach(Languages::getAvailableLanguagesAsArray() as $lid => $language)

		{

			$tab = array();

			$tab['title'] = htmlentities($language);

			$tab['view'] = 'translationForm';

			$tab['data'] = array('form'=>$form, 'languageId'=>$lid, 'translationId'=>$translation->translation_id, 

									'model'=>$model, 'value'=>$translation->value);

			$tabs[$language] = $tab;

		}

	

		$this->widget('CTabView',array(

        	'tabs'=>$tabs,

			'id'=>'translationGridSwitchId',


		));

		

		Yii::app()->end();



Once again i cut the round-about (which is just for content) so you can focus on the important parts.

The problem now is, the widget CTabView comes along without any css or javascript, is just get a list of what should be the tabs and i cant click on them. After some research-hours I added the following lines, which seemed to be the answer:





		$cs=Yii::app()->getClientScript();

		$cs->registerCoreScript('yiitab');

$cs->registerScript('Yii.CTabView#translationGridSwitchId',"jQuery('#translationGridSwitchId').yiitab();");

$url=$cs->getCoreScriptUrl().'/yiitab/jquery.yiitab.css';

        $cs->registerCssFile($url,'screen');



Reload - looked good, css was loaded. But… nothing happend when clicking the tabs. I checked the browser sourcecode and found the lines:




<script type="text/javascript" src="/Psychometrika/all/Psychometrika/assets/d2fb405f/jquery.yiitab.js"></script>

[...]

jQuery(function($) {

jQuery('#translationGridSwitchId').yiitab();



Compared to another site where i use CTabView (but loaded with the whole site) it looks exactly the same… so I dont know what to do. Any ideas of your site maybe?

Right now Im thinking the problem is because the browser dont fit in the content of the ajax call properly in the already existing DOM, means the javascript code cant find the buttons (HTMLtags) and change them… but how to solve?

Regards

Ballamann

ps: sorry for my english, im from germany ;)

no one any idea? =(