簡體   English   中英

Yii-CHtml :: ajaxLink-TypeError:設置未定義

[英]Yii - CHtml::ajaxLink - TypeError: settings is undefined

我正在顯示使用CGridView從名為Object的模型生成的表。 我希望能夠選中一個復選框,然后轉到“提交”控制器的“創建”操作,在這里我將使用所選行的ID。 我讀到可以使用$.fn.yiiGridView.getChecked函數,但無法正常工作。 Firebug顯示的錯誤是

TypeError: settings is undefined
...s).children('tbody').children('tr').children('td').children('input[name="' + col...

這是我的看法:

<?php
$this->widget('zii.widgets.grid.CGridView', array(
   'id'=>'Object', // the containerID for getChecked
   'dataProvider'=>$dataProvider,
   'columns'=>array(
       array(
           'class'=>'CCheckBoxColumn',
           'id'=>'example-check-boxes' // the columnID for getChecked
       ),
        array(
            'name'=>'object_name',
            'type'=>'text',
        ),
//more columns     
   ),
));
?>
<?php
   echo CHtml::ajaxLink('Next',Yii::app()->createUrl('submission/create'),
        array(
           'type'=>'POST',
           'data'=>'js:{theIds : $.fn.yiiGridView.getChecked("object","example-check-boxes").toString()}'
        )
   );
?>

更改此:

'data'=>'js:{theIds : $.fn.yiiGridView.getChecked("object","example-check-boxes").toString()}'

對此:

'data'=>'js:{theIds : $.fn.yiiGridView.getChecked("Object","example-check-boxes").toString()}'

您確實編寫了object ,但是gridview的ID是Object ,大寫的是O。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM