Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Help With Dataprovider And Renderpartial

$
0
0
Hi all,

I am trying to show a renderPartial view that contains data from another model and controller but am hitting a few problems that I hope someone can point me in the right direction with?

I have a view that when navigated to shows a CGridView of data.

Firstly this is the view -

$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'properties-grid',
    'dataProvider'=> $dataProvider,
        array(
            'class' => 'CButtonColumn',
            'buttons' => array(
                'update' => array(
                    'label' => '<i class="icon-user"></i> <span>View Property</span>',
                    'options' => array('class' => 'btn btn-small'),
                    'url' => 'Yii::app()->createUrl("properties/update", array("id"=>$data->pr_id))',
                ),
            ),
        ),
    ),
));


The controller for this view is -

      public function actionshowProperties() {

            $criteria = new CDbCriteria(array(
                'condition' => 'pr_id=14',
            ));

            $dataProvider = new CActiveDataProvider('Properties', array(
                'criteria' => $criteria,
            ));

            $this->render('showProperties', array(
                'dataProvider' => $dataProvider,
            ));
      }


Navigating to this page shows the correct data but I need to do something else with this. I now need to be able to show this view in another model.

I call the view using renderPartial, like this -

<?php $this->renderPartial('application.views.properties.showPropertiesInAuction', array('dataProvider' => $dataProvider)); ?>


The partial view does appear in the other view and it shows data but not the data that I filtered using the criteria variable in the original controller.

Does anyone know why this is and how to show the correct data?

Many thanks

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>