gpt4 book ai didi

javascript - $(gridID).yiiGridView ('getChecked' , columnID) 返回空数组

转载 作者:行者123 更新时间:2023-12-03 07:43:49 25 4
gpt4 key购买 nike

我只想存储票证项目的 id,当我检查控制台时,我只是得到一个空数组。知道为什么吗?

CCheckBoxColumn 上的 Yii 文档指出:

You may also call the JavaScript function $(gridID).yiiGridView('getChecked', columnID) to retrieve the key values of the checked rows.

所以我有:

 $this->widget('bootstrap.widgets.BsGridView', array(
'id' => 'audits-lines-grid',
'dataProvider' => $auditlines->search($model->audit_id),
'filter' => $auditlines,
'selectableRows' => 2,
'columns' => array(

array(
'class' => 'CCheckBoxColumn', 'selectableRows' => 2,
'id' => 'selected-checkboxes',
'value' => 'CHtml::tag("span", array("class" => "$data->statusLabel"), "$data->status", "</span>")',
'name' => 'CHtml::tag("span", array("class" => "$data->statusLabel"), "$data->status", "</span>")',
),
(some more code here..)

我正在尝试使用

获取检查值
<script>
$(document).on('click','#block-change-location',function(){
var items = $('#audits-lines-grid').yiiGridView('getChecked', '#selected-checkboxes')
console.log(items);
});
</script>

最佳答案

使用

$.fn.yiiGridView.getChecked("your-grid-id", "selected-checkboxes"); 

关于javascript - $(gridID).yiiGridView ('getChecked' , columnID) 返回空数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35294124/

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