frameworks - Yii Clistview only print once -


i want echo div once in clistview, items order status, so, want print status 1 -> items, , status 2 -> items status, tried viewdata, dont know how change value of flag.

index view:

<div class="modal-body">         <?php              $activos_flag = 1;             $inactivos_flag = 1;         ?>         <?php              $this->widget('zii.widgets.grid.clistview', array(                 'id'=>'incs',                 'summarytext'=>'',                 'dataprovider'=>$dataproviderinc,                 'itemview'=>'_incidencias',                 'viewdata'=> array('activo'=> $activos_flag,'inactivo'=>$inactivos_flag),             ));         ?>     </div> 

_incidencias view:

<?php      if ($data->activo == 1 , $data->incidencia_estado == 1){         echo ('<label class="incidencias">activos</label>');         $data->activo = 0;     }     if ($data->inactivo == 1 , $data->incidencia_estado == 0){         echo ('<label class="incidencias">inactivos</label>');         $data->inactivo = 0;     } ?> 

you need value not array $data ($data->inactivo) directly variable $inactivo. in case, @ each iteration, value of these variables again equal 1. in case, can use following approach: before widget declaration:

yii::app()->params['activos_flag']=1; yii::app()->params['inactivos_flag']=1; 

and in parial view:

if ( yii::app()->params['activos_flag'] == 1 ){     echo ('<label class="incidencias">activos</label>');     yii::app()->params['activos_flag'] = 0; } if ( yii::app()->params['inactivos_flag'] == 1 ){     echo ('<label class="incidencias">inactivos</label>');     yii::app()->params['inactivos_flag'] = 0; } 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

angularjs - ng-repeat duplicating items after page reload -