gpt4 book ai didi

javascript - Yii - CHtml::ajaxLink - TypeError:设置未定义

转载 作者:行者123 更新时间:2023-11-28 08:20:39 28 4
gpt4 key购买 nike

我正在使用CGridView显示从名为Object的模型生成的表。我希望能够选中一个复选框,然后转到提交 Controller 的“创建”操作,我将在其中使用所选行的 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。

关于javascript - Yii - CHtml::ajaxLink - TypeError:设置未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23010460/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com