Rendering Cgridview As A Partialal

Hello:-)

I’d like to render CGridView as a popup window. So i have jquery load function doing the AJAX call to controller action

where there is a renderPartial method rendering view-script with CGridView widget. The result of the script

is then returned and placed in container element calling load.

In the partial wiew-script besides CGridView widget i have some js code.

And here the problems starts.

When i call the partial by load-bounded element everything works great - CGridViev is rendered and

js script is executed. BUT when i use pagination buttons to do the ajax & render the script

CGridViev is rendered but js script isn’t executed at all. The response from each type of call

is the same. There is js code inside it but in case of pagination call js is just ignored by browser!?

Here is some code to make things clearer

in "main" view:


$('#editRowPrefixDiv').load( '$url_prefix', function( response, status, xhr ) {...}

in controller:


public function action...(){

	...

	$this->renderPartial('cennik_prefixGridSimple'...);

}

partial view-script:


$this->widget ( 'zii.widgets.grid.CGridView', array (...))


Yii::app ()->clientScript->registerScript (...)

And what’s even more odd even in a such brutal way:


<script type="text/javascript">

//<![CDATA[

	alert('lopp:-)');

//]]>

</script>


$this->widget ( 'zii.widgets.grid.CGridView', array (...))

the js is always ignored using pagination

Please help me as You can…

I suggest you, please use bootstrap model to display as you want. not need to use renderPartial in action controller. rendering the bootstrap model view-script in same view through renderPartial method. just hide this and call ajax to show this model and display the data as you want in bootstrap model.

Demo - http://yiidemos.gopagoda.com/

Source code - https://github.com/sirinibin/yiidemos