Hi,
I am trying to get Dynamic parent and child CGridView on single view working. I have tried to follow this article:
but I have failed as I get the above error.
Now I am an experienced programmer but am learning PHP, java and the yii framework all on the fly. So I may be attempting too much but hey I like a good challenge.
The difference for me is also that my tables are a one to many relationship.
So I have a Section with many breeds.
This is my models:
rabbitsection
public function rules()
{
	// NOTE: you should only define rules for those attributes that
	// will receive user inputs.
	return array(
		array('RabbitSectionName, RabbitSectionOrder', 'required'),
		array('RabbitSectionOrder', 'numerical', 'integerOnly'=>true),
		array('RabbitSectionName', 'length', 'max'=>100),
		// The following rule is used by search().
		// Please remove those attributes that should not be searched.
		array('RabbitSectionId, RabbitSectionName, RabbitSectionOrder', 'safe', 'on'=>'search'),
	);
}
rabbitbreed
public function rules()
{
	// NOTE: you should only define rules for those attributes that
	// will receive user inputs.
	return array(
		array('RabbitBreedName, RabbitBreedOrder, RabbitSectionId', 'required'),
		array('RabbitBreedOrder, RabbitSectionId', 'numerical', 'integerOnly'=>true),
		array('RabbitBreedName', 'length', 'max'=>100),
		// The following rule is used by search().
		// Please remove those attributes that should not be searched.
		array('RabbitBreedId, RabbitBreedName, RabbitBreedOrder, RabbitSectionId', 'safe', 'on'=>'search'),
	);
}
admin.php
<?php echo CHtml::link(‘Advanced Search’,’#’,array(‘class’=>‘search-button’)); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial(’_search’,array(
'model'=>$rabbitsection_model,
)); ?>
</div><!-- search-form -->
<div id="sectionView">
/*
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'rabbitsection-grid',
'dataProvider'=>$rabbitsection_model->search(),
'filter'=>$rabbitsection_model,
'columns'=>array(
	'RabbitSectionId',
	'RabbitSectionName',
	'RabbitSectionOrder',
	array(
		'class'=>'CButtonColumn',
	),
),
)); ?>
*/
<?php $this->widget(‘zii.widgets.grid.CGridView’, array(
'id'=>'rabbitsection-grid',
'dataProvider'=>$rabbitsection_model->search(),
'filter'=>$rabbitsection_model,
'columns'=>array(
	'RabbitSectionId',
	'RabbitSectionName',
	'RabbitSectionOrder',
	array(
		'class'=>'CButtonColumn',
	),
),
'ajaxupdate' => 'rabbitbreed-grid',
)); ?>
</div>
<!-- The childView <div>, renders the _child form, which contains the Child Gridview.
The ajax response will replace/update the whole <div> and not just the gridview. -->
<div id="rabbitbreedView">
<?php
    $this->renderPartial('_rabbitbreed', array(
    'rabbitbreed_model' => $rabbitbreed_model, 
    'rabbitsectionID' => $rabbitsectionID, 
    ))
?>
</div>
<?php
/*Load the javascript file that contains our own ajax function*/
$path = Yii::app()->baseUrl.'/js/customFunctions.js';
Yii::app()->clientScript->registerScriptFile($path,
CClientScript::POS_END);
?>
_rabbitbreed.php (in view folder of rabbitsection)
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'rabbitbreed-grid',
'dataProvider'=>$rabbitbreed_model->searchIncludingPermissions($rabbitsectionID),
'filter'=>$rabbitbreed_model,
'columns'=>array(
    'rabbitbreeedid',
    array(
        'name'=>'RabbitSectionName',
        'value'=>'RabbitSectionName', /* Test for
            empty related fields not to crash the program */
        'header'=>'Breed',
        'filter' => CHtml::activeTextField($rabbitbreed_model,
        'rabbitsectionName'),
    ),
    array(
        'class'=>'CButtonColumn',
        'template'=>'{view}{update}{delete}',
        'viewButtonUrl' => 'array("rabbitbreed/view",
        "id"=>$data->rabbitbreedid)',
        'updateButtonUrl' => 'array("rabbitbreed/update",
        "id"=>$data->rabbitbreedid)',
        'deleteButtonUrl' => 'array("rabbitbreed/delete",
        "id"=>$data->rabbitbreedid)',
    ),
),
));
?>
RabbitsectionController.php
public function actionAdmin()
{
        $rabbitsection_model = new Rabbitsection('search');
        $rabbitsection_model->unsetAttributes();
        
        if (isset($_GET['Rabbitsection']))
            $rabbitsection_model->attributes=$_GET['Rabbitsection'];
        
        if(!isset($_GET['RabbitSectionId'])){
            $group="A";
            $criteria=new CDbCriteria;
            $criteria->compare('RabbitSectionId',$rabbitsection_model->RabbitSectionId,TRUE);
            $criteria->compare('rabbitsectionName', $rabbitsection_model->RabbitSectionName,TRUE);
            $dataProvider = new CActiveDataProvider('rabbitsection', array(
                'criteria'=>$criteria,
            ));
            
            If (count($dataProvider->getData())>0){
                $first_model =$dataProvider->getData();
                $rabbitsectionid = $first_model[0]->RabbitSectionId;
            }
            else{
                $rabbitsectionid = 0;
            }
        }
        else{
            $group = "B";
            $rabbitsectionid = $_GET['RabbitSectionId'];
        }
        $rabbitbreed_model = new Rabbitbreed("searchIncludingBreeds($rabbitsectionid");
        $rabbitbreed_model->unsetAttributes();
        $rabbitbreed_model->scenario = 'searchIncludingBreeds';
        if(isset($_GET["Rabbitsection"]))
            $rabbitbreed_model->attributes=$_GET["Rabbitsection"];
        
        if ($group=="A"){
            $this->render('admin', array(
                'rabbitsection_model'=>$rabbitsection_model,
                'rabbitbreed_model'=>$rabbitbreed_model,
                'RabbitSectionId'=>$rabbitsectionid,
            ));
        }
        else{
            $this->renderPartial('_rabbitbreed', array(
            'rabbitbreed_model'=>$rabbitbreed_model,
            'RabbitSectionId' => $rabbitsectionid,
            ));
            }
}
And I have put the ajax code into a customFunctions.js in a js subfolder.
Now this is where I think I have gone wrong and which is not clear in the article. How do I define the js code in the customFunctions.js?
Or do I have it totally wrong?