我如何知道选中的复选框?

时间:2013-10-29 11:42:21

标签: jquery checkbox jqgrid

我有这个Jqgrid,函数multiselect = true。现在,我想知道如何选中复选框?我需要知道,因为如果选中复选框,我会向这些人发送消息。我想我需要FOR,但我不知道如何使用它

$.getJSON("/Page/pop", function (data) {
            var data = data;

            $('#table').jqGrid({
                datatype: 'local',
                data: data,
                colNames: ['Code', 'Client', 'Email', 'Copy Email', ''],
                colModel: [

                            { name: 'rec', index: 'rec' },
                            { name: 'nmcli', index: 'nmcli' },
                            { name: 'listEm', index: 'listEm' },
                            { name: 'listEmCp', index: 'listEmCp' },
                            { name: 'cdrec', index: 'cdrec', hidden: true}],
                viewrecords: true,
                multiselect: true,
                imgpath: 'jqGrid-3.4.3/themes/coffee/images',
                height: 'auto',
                width: 1680
            });
        });

5 个答案:

答案 0 :(得分:0)

if($('#ckBox')。is(':checked')){

/ *做点什么* /

}

http://api.jquery.com/checked-selector

答案 1 :(得分:0)

我不知道Jqgrid是什么,但无论如何

$( “复选框选择器”)是( “:检查”)

答案 2 :(得分:0)

 $("input[type=checkbox]").change( function() {
  if($(this).is(":checked")){
     alert( $(this).val() );
  }
});

Demo of link

答案 3 :(得分:0)

 function checkids() 
 {
        var s;
        s = jQuery('#EmailTable').getGridParam('selarrrow');
        if (s == "") 
        {
            alert("No record selected.");
            return false;
        }
  }
 Call checkids() function on button click event. 

答案 4 :(得分:0)

jqGrid支持回调onSelectRowonSelectAll以及事件jqGridSelectRowjqGridSelectAll“以通知”您的用户选择网格的某一行。请参阅the documentation

我建议您另外删除jqGrid中不存在的imgpath选项多年(请参阅documentation),添加gridview: true选项以提高网格性能,添加{ {1}}确保在网格中成功显示所有数据(包括特殊HTML字符),并从autoencode: true中删除所有index属性。

相关问题