如何在Yii框架中单击按钮添加子选项卡?

编程入门 行业动态 更新时间:2024-10-12 14:20:19
本文介绍了如何在Yii框架中单击按钮添加子选项卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

请帮助在 Yii 框架中实现这一点.单击此添加按钮(如图所示的 + 按钮)需要创建更多选项卡.

Please help to achieve this in Yii framework. onclick of this add button(+ button as showned in image) need to create more tabs.

我可以在我的 View 类中使用以下代码来显示标签

I can display tabs by using following code in my View class

 <?php 
   $this->widget('CTabView', array(
    'tabs'=>array(
        'tab1'=>array(
            'title'=>'Tab1',
            'view'=>'tabs',
            'data'=>array('model'=>BCFormField::model(),),
        ),
)
 )));
?>

但是让我知道如何添加更多 chiltab,点击这个 + 按钮.

But let me know how to add more chiltab, onclick of this + button.

推荐答案

我建议通过触发选项卡的可见性来棘手地添加选项卡.事先根据需要创建尽可能多的选项卡(例如 30),并在特定条件下设置它们的可见性(例如 db 字段).然后单击您更改关键字段/变量并显示一个选项卡.

I suggest to tricky add tabs by triggering tabs' visibility. Create as many as needed tabs (ex. 30) beforehand and set their visibility on certain condition (db field for ex.). Then on click you change the key field/variable and a tab gets visible.

看我的案例:

    'tab7'=>array(
        'title'=>Yii::t('general', 'Products / Services'),
        'view'=>'_form_ordercontent',
        'data'=>array('eventId'=>$model->Id),
    'visible' => $model->EventTypeId == DocEvents::TYPE_ORDER || $model->EventTypeId == DocEvents::TYPE_INFLOW || $model->EventTypeId == DocEvents::TYPE_SALE
    ),
    'tab8'=>array(
        'title'=>'Payment',
        'view'=>'_form_payment',
        'data'=>array('model'=>$model, 'eventId'=>$model->Id),
     'visible' => Yii::app()->user->checkAccess('1');
    ),

因此,当您按下按钮时,某些变量(或模型属性)会发生更改并且相应的选项卡会暴露出来,它们的内容将被预定义它适合你的情况吗?

So as you push button certain variable (or model attribute) gets changed and corresponding tabs get exposed, their content being predefined Does it fit your case?

这篇关于如何在Yii框架中单击按钮添加子选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-23 18:24:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047436.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单击   选项卡   框架   按钮   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!