yii框架中的2个选项卡

时间:2012-03-05 08:12:29

标签: yii

我现在的任务是使用yii作为框架创建一个网站。关于如何在每个选项卡上显示2个带有网格视图的选项卡,我想为您提供帮助。我能够创建选项卡,但每次我在选项卡中放置网格视图时,第一个选项卡将不显示网格视图,只有最后一个选项卡将显示网格视图。

这是第1和第2个标签的代码

     <div id="gridview-claims">
        <script type="text/javascript">
        if ($gif.content) {
            $.extend($gif.content, {
                //DO SYSTEM SPECIFIC STUFF AFTER CONTENT IS LOADED
                onload : function (content) {
                //APPLY FLEXGRID TO TABLES
                $.get('/ADS/index.php/claims/admin', function (data) {
                    content.find('#gridview-claims').html(data);
                    });                 
                    }
                });
            }
            </script>
            </div>


<div id="tb-2-content" class="tb-content hidden">
            <div id="gridview-deduction">
            <script type="text/javascript">
            if ($gif.content) {
                $.extend($gif.content, {
                //DO SYSTEM SPECIFIC STUFF AFTER CONTENT IS LOADED
                onload : function (content) {
                //APPLY FLEXGRID TO TABLES
                $.get('/ADS/index.php/deduction/admin', function (data) {
                content.find('#gridview-deduction').html(data);

                    });         

                    }
                });
            }
            </script>
            </div>

2 个答案:

答案 0 :(得分:1)

我建议你改用Yii中的jquery小部件。对于每个选项卡,您可以使用渲染功能显示您的网格。

例如:

$this->widget('zii.widgets.jui.CJuiTabs', array(
        'tabs'=>array(
            'Pediatric Info'=> $this->renderPartial("_view", array('data' => $model, 'patientID'=> $model->id), true, true), 
            'Contacts' =>$this->renderPartial("_viewContacts", array('data' => $model, 'patientID'=> $model->id), true, true), 
            // panel 3 contains the content rendered by a partial view
            'Insurance'=> $this->renderPartial("_viewInsurance", array('data' => $model, 'patientID'=> $model->id), true, true), 
            'Activities' =>$this->renderPartial("_viewEncounters", array('data' => $model, 'patientID'=> $model->id), true, true), 
        ),
        // additional javascript options for the tabs plugin
        'options'=>array('collapsible'=>true,),
    ));

答案 1 :(得分:0)

有两种形式的2个标签适合我..

  <?php
      $this->widget('zii.widgets.jui.CJuiTabs', array(
        'tabs'=>array(
             'Share By Email'=> $this->renderPartial("_form", array('model' => $model), true, true), 
             'Share to Friends'=> $this->renderPartial("_friendsform", array('model' => $model), true, true), 


        ),
        // additional javascript options for the tabs plugin
        'options'=>array('collapsible'=>true,),
    ));


?>