Hey guys
In my admin.php-view I decided to render my CGridView partially. Now the layout (pagination, selection,…) has completely changed. I cannot select any row like I did when I rendered the Grid normally.
Pictures (before/after) are attatched.
I didn’t change any code in my Grid, so what went wrong?
Best regards
MH
_grid.php partial view:
<?php
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
$('.search-form').toggle();
return false;
});
$('.search-form form').submit(function(){
$('#frage-grid').yiiGridView('update', {
data: $(this).serialize()
});
return false;
});
");
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'frage-grid',
'dataProvider'=>Frage::model()->search($data),
'filter'=>$model, // <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />
//'selectableRows' => 1,
//'htmlOptions' => array('style'=>'width:350px;'),
'columns'=>array(
'e3.e2.e1.e1bez', //
'e3.e2.e2bez', //
'e3.e3bez', //
'fbez',
array( // display a column with "view", "update" and "delete" buttons
'class'=>'CButtonColumn',
),),)); ?>
admin.php view:
<div class="row">
<?php echo $form->labelEx($model3,'Person'); ?>
<?php echo $form->dropDownList($model3,'pid', $model3->getPersonsByKid(),array( //Person::model()->getPersonsByKid()
//'prompt'=>'Alle',
'ajax' => array(
'type'=>'POST',
'url'=>CController::createUrl('Frage/GetFragen'),
'update'=>'#frage-grid',
'data'=>array('pid'=>'js:this.value'),
) ));
?>
<?php echo $form->error($model3,'kid'); ?>
</div>
<div class="row"></br></div><div class="row"></div>
<div id="frage-grid">
</div>
Controller action:
public function actionGetFragen() {
$model = new Frage('search');
$data = $_POST['pid'];
$this->renderPartial('_grid', array(
'data' => $data, 'model'=>$model,
));
}
PLEASE HELP