Gridview added via ajax missing settings

I am creating a new Gridview via ajax and add data to the new grid via ajax. The problem comes up when I try and refresh it with $.fn.yiiGridView.update, I get a settings undefined error. I have done some digging and have some code examples below.

main view




        <div class="projects">

            <?php $this->renderPartial('_manageProjects',$model->search()); ?>

        </div>

        <div id="schedule_container">

        </div>



I then have some javascript that is run when a row is selected, it run’s the following ajax




                echo CHtml::ajax( array(

                    'type'=> 'post',

                    'url'=> CController::createUrl('projects/displaySchedule'),

                    'data' => 'js:data',

                    'update' => '#schedule_container'

                ));



The ‘projects/displaySchedule’ renders a partialview containing a CGridViw. If I then run $.fn.yiiGridView.update the application crashes with the error




settings is undefined


gridview/jquery.yiigridview.js Line 203



I have tried a million different things but can’t seem to get it working. Has anyone else had a similar problem and been able to find a work around?

Or is there a way to add a filter a new dataprovider without rerendering the widget?

From what you said, I imagine that this wiki could help you.

Dynamic parent and child CGridCiew on single view. Using $.ajax to update child gridview via controller (with MANY_MANY relation), after row in parent gridview was clicked.

I went over this tutorial but believe I would have the same problem. I am implementing something similar and the problem arises when I try and run $.fn.yiiGridView.update on the child grid.

Solved,

So the reason this was happening was because renderPartial by default only renders html, it doesn’t render javascript or css. I turned on rending of javascript along with using this extension to manage scripts that have been loaded already.

http://www.yiiframework.com/extension/nlsclientscript/#hh3