Hi, I encounter an issue when rendering a small partial view (from a different model) and when I click on the ajax search.
Some columns always fail returning a blank grid whereas some columns never fail.
When I render the partial view on some other pages none columns fail.
My goal is to render a list of related model in a view of the parent model. Those view are present all across my app so I want them to be rendered with renderPartial.
So this is my code, it’s pretty straightforward :
<?php
$this->widget('bootstrap.widgets.TbGridView', array(
'dataProvider' => $dataProvider,
'type' => 'striped condensed',
'template' => "{items}\n{pager}",
'htmlOptions' => array('class' => 'shortlist'),
'columns' => array(
array(
'name' => 'id',
'header' => '#',
'type' => 'raw',
'value' => 'CHtml::link($data->id, array("mymodel1/view", "id" => $data->id))',
'htmlOptions' => array('class' => 'tiny-column'),
),
array(
'header' => Yii::t('cms', 'Language'),
'name' => 'locale',
'value' => '$data->locale->name',
'htmlOptions' => array('class' => 'span2'),
),
array(
'name' => 'title',
'type' => 'raw',
'value' => 'CHtml::link($data->title, array("mymodel1/view", "id" => $data->id))'
),
),
));
?>
I render it with :
<?php
$dataProvider = new CArrayDataProvider($model->itSubModel, array(
'sort' => array(
'attributes' => array('locale', 'id', 'title')
),
'pagination' => array(
'pageSize'=>15,
)
));
$this->renderPartial('/mymodel1/_shortlist', array('dataProvider' => $dataProvider));
?>
For this specific example on some model view (let’s call it parentModel1/view) all work fine but on an other model view (parentModel2/view) when I click on “Language” the grid disappear.
I should also mention that other partial views like this one are rendered on parentModel1/view and parentModel2/view (for other related models) and I encounter same problems with some columns.
I believe there is a conflict between those model or between submodel and parentmodel for sorting but I don’t know how to fix it.
Thanks for your support!