【问题标题】:Yii Index View Data Rendering With ConditionYii Index View 数据渲染有条件
【发布时间】:2013-03-06 06:34:56
【问题描述】:

我是 yii 框架的新手,我创建了一个带有一个模块的 yii Web 应用程序。 现在我的问题是我在我的模块中的模块中添加了一个示例数据我有一个列名称,部门和活动,我想在网格视图中呈现数据只有活动= 0的数据,谁能帮助我如何更改数据渲染查询以及如何添加条件

<div class="block">
<div class="content">
    <h2 class="title">Users's details</h2>
    <div class="inner">
        <?php $this->widget('zii.widgets.CDetailView', array(
            'data' => $model,
            'attributes' => array(
                'user_id',
                'user_name',
                'userpass',
                'userdept',
                'active',
            ),
            'itemTemplate' => "<tr class=\"{class}\"><td style=\"width: 120px\"><b>{label}</b></td><td>{value}</td></tr>\n",
            'htmlOptions' => array(
                'class' => 'table',
            ),
        )); ?>
    </div>
</div>

提前致谢。

【问题讨论】:

  • 显示您的数据提供者。

标签: yii-extensions yii


【解决方案1】:

尝试添加条件

$criteria->compare('active', '1');

【讨论】:

    【解决方案2】:

    你必须在你的搜索功能中添加这个:

    $criteria->compare('active', '1');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-08
      • 2021-01-10
      • 2020-06-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多