Yii ajaxLink jquery视图无法正常工作

时间:2013-05-10 05:58:31

标签: jquery tabs yii datatable

在我的页面上,我有一个三页的标签视图。对于这个使用CHtml :: ajaxLink如下

<li >
                  <?php  echo CHtml::ajaxLink("Manual Billing", CController::createUrl('billing/manualbilling'), array('update' => 'html',
                                'type' => 'POST',));?>
                </li>
                <li>
                      <?php  echo CHtml::ajaxLink("Billing History", CController::createUrl('billing/historyBilling'), array('update' => 'html',
                                'type' => 'POST',

                                      ));?>
                </li>
                <li>
                       <?php  echo CHtml::ajaxLink("Merchant Wise Billing Status", CController::createUrl('billing/manualbilling'), array('update' => 'html',
                                'type' => 'POST'), array(//htmlOptions
                              //  'class' => "reportlink"
                            ));?>
                </li>

作为给定的url页面正在加载但是问题是我在视图页面中给出了一些jQuery函数来实现无效的数据表。

$(document).ready(function() {
        $('#example').dataTable( {
            "sScrollY": "400px",
            "bPaginate": false,
            "oLanguage": {

                "sEmptyTable": "No records to display"
            },

            "sDom": 'T<"clear">lfrtip',
            "aaSorting": [],
            "aoColumns": [
                { "bSortable": false },
                null,
                null,
                null,
                null,
                null,
            ],
            "oTableTools": {
                "sSwfPath": "<?php echo Yii::app()->request->baseUrl; ?>/media/js/TableTools/media/swf/copy_csv_xls_pdf.swf",                                      
                "aButtons": [
                    {
                        "sExtends": "print",
                        "sInfo": "Please press escape when print is completed."
                    }

                    //                                                 {
                    //                    "sExtends":    "collection",
                    //                   // "sButtonText": "Save",
                    //                    "aButtons":    [ "csv", "xls", "pdf" ]
                    //                }
                ]
            }

        } );

    } );  

它甚至没有进入document.ready()。请帮忙

2 个答案:

答案 0 :(得分:1)

感谢使用CJuiTabs小部件解决@Kevin Higgins问题

$tabs = array(); 

                $tabs['Manual Billing'] = array( 
                        'id'=>'dataFieldsTab', 
                        'class'=>'bill',
                        'content'=>$this->renderPartial('manualbilling',$paramsm,true), 
                ); 

                $tabs['Billing History'] = array( 
                        'id'=>'linkedChildrenTab1', 
                        'class'=>'bill',

                        'content'=>$this->renderPartial('historyBilling',$paramsh,true), 
                ); 


                $this->widget('zii.widgets.jui.CJuiTabs', array(  
                        'tabs' => $tabs, 
                        'options' => array( 
                                'collapsible' => false, 
                                'active' => 0,
                        ), 
                )); 

感谢每一位求助

答案 1 :(得分:0)

您的问题源于jQuery ajax调用如何处理条带标记。

看一下这篇文章的修复: jQuery - script tags in the HTML are parsed out by jQuery and not executed