Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 选中/取消选中JqGrid标题复选框_Jquery_Jqgrid - Fatal编程技术网

Jquery 选中/取消选中JqGrid标题复选框

Jquery 选中/取消选中JqGrid标题复选框,jquery,jqgrid,Jquery,Jqgrid,我的标题栏复选框不能正常工作。请指导我,我做错了什么 以下是我的名字: colNames: ['', '<input type="checkbox" id="cbox" onclick="checkBox(event)" />', 'Fee Type', 'Description','Actions'] 这是我的初始屏幕: 单击“标题栏”复选框时,我希望选中所有其他行复选框,如果未选中任何行复选框,则选中“标题”复选框。我想您是在追求以下目标: multiselect: tr

我的标题栏复选框不能正常工作。请指导我,我做错了什么

以下是我的名字:

  colNames: ['', '<input type="checkbox" id="cbox" onclick="checkBox(event)" />', 'Fee Type', 'Description','Actions']
这是我的初始屏幕:


单击“标题栏”复选框时,我希望选中所有其他行复选框,如果未选中任何行复选框,则选中“标题”复选框。

我想您是在追求以下目标:

multiselect: true
这允许在每一行上实现复选框,并在标题行上选择所有复选框

您可以输入提供的选项:

    loadtext: "Loading",
    width: 795,
    multiselect: true, // <------like here or your choice.
    hoverrows: false,
loadtext:“加载”,
宽度:795,

multiselect:true,//最简单、最好的方法就是使用multiselect。在colNames中不需要使用input type=复选框。下面我举一个例子

                        data: JSON.parse(result), //Load Data
                        loadonce: true,
                        rowList: [5, 10, 20],
                        rowNum: 10, //Total records to display by default
                        pager: '#EmpPager',
                        viewrecords: true,
                        sortorder: 'asc',
                        gridview: true,
                        sortname: 'FirstName',
                        height: 'auto',
                        altRows: true,
                        hoverrows: true,
                        caption: "Student Details",
                        multiselect: true

您可以将其放置在具有所有其他选项(如
gridComplete
等)的位置。检查答案。当我放置multiselect:true时,它会在每行中创建一个标题复选框和相应的复选框,并具有突然行为。请参阅,您已删除所有自定义复选框和格式化程序回调。更新列:
colNames:['','费用类型','说明','行动']
我删除了所有自定义格式化程序复选框,它会自动创建标题和所有行复选框,但当我单击标题复选框时,它不会选中所有行复选框。例如,我在jqgrid中有三行,它只选择前两行,当我通过单击第三行中的复选框选择第三行,然后取消选中标题复选框时,第三行d行复选框保持选中状态。我不知道为什么??是的,我已经更新了我的列名。
multiselect: true
    loadtext: "Loading",
    width: 795,
    multiselect: true, // <------like here or your choice.
    hoverrows: false,
                        data: JSON.parse(result), //Load Data
                        loadonce: true,
                        rowList: [5, 10, 20],
                        rowNum: 10, //Total records to display by default
                        pager: '#EmpPager',
                        viewrecords: true,
                        sortorder: 'asc',
                        gridview: true,
                        sortname: 'FirstName',
                        height: 'auto',
                        altRows: true,
                        hoverrows: true,
                        caption: "Student Details",
                        multiselect: true