Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.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_Free Jqgrid - Fatal编程技术网

Jquery 免费jqgrid工具栏搜索和标题分组

Jquery 免费jqgrid工具栏搜索和标题分组,jquery,jqgrid,free-jqgrid,Jquery,Jqgrid,Free Jqgrid,我使用的是免费的jqgrid v4.15.5,在工具栏搜索和标题分组方面有问题 这是我正在使用的示例代码和问题 $(document).ready(function () { var myData = [ { id: "1", invdate: "2007-10-01", name: "test", note: "note", amount: "200.00", tax: "10.00", closed: true, ship_via: "TN",

我使用的是免费的jqgrid v4.15.5,在工具栏搜索和标题分组方面有问题

这是我正在使用的示例代码和问题

$(document).ready(function () {
        var myData = [
                { id: "1", invdate: "2007-10-01", name: "test", note: "note", amount: "200.00", tax: "10.00", closed: true, ship_via: "TN", total: "210.00" },
                { id: "2", invdate: "2007-10-02", name: "test2", note: "note2", amount: "300.00", tax: "20.00", closed: false, ship_via: "FE", total: "320.00" },
                { id: "3", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", closed: false, ship_via: "FE", total: "430.00" },
                { id: "4", invdate: "2007-10-04", name: "test4", note: "note4", amount: "200.00", tax: "10.00", closed: true, ship_via: "TN", total: "210.00" },
                { id: "5", invdate: "2007-10-31", name: "test5", note: "note5", amount: "300.00", tax: "20.00", closed: false, ship_via: "FE", total: "320.00" },
                { id: "6", invdate: "2007-09-06", name: "test6", note: "note6", amount: "400.00", tax: "30.00", closed: false, ship_via: "FE", total: "430.00" },
                { id: "7", invdate: "2007-10-04", name: "test7", note: "note7", amount: "200.00", tax: "10.00", closed: true, ship_via: "TN", total: "210.00" },
                { id: "8", invdate: "2007-10-03", name: "test8", note: "note8", amount: "300.00", tax: "20.00", closed: false, ship_via: "FE", total: "320.00" },
                { id: "9", invdate: "2007-09-01", name: "test9", note: "note9", amount: "400.00", tax: "30.00", closed: false, ship_via: "TN", total: "430.00" },
                { id: "10", invdate: "2007-09-08", name: "test10", note: "note10", amount: "500.00", tax: "30.00", closed: true, ship_via: "TN", total: "530.00" },
                { id: "11", invdate: "2007-09-08", name: "test11", note: "note11", amount: "500.00", tax: "30.00", closed: false, ship_via: "FE", total: "530.00" },
                { id: "12", invdate: "2007-09-10", name: "test12", note: "note12", amount: "500.00", tax: "30.00", closed: false, ship_via: "FE", total: "530.00" }
        ],
            myGrid = $("#list");

        myGrid.jqGrid({
            datatype: 'local',
            data: myData,
            colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Closed', 'Shipped via', 'Notes'],
            colModel: [
                { name: 'id', index: 'id', width: 70, align: 'center', sorttype: 'int' },
                {
                    name: 'invdate', index: 'invdate', width: 80, align: 'center', sorttype: 'date',
                    formatter: 'date', formatoptions: { newformat: 'd-M-Y' }, datefmt: 'd-M-Y'
                },
                { name: 'name', index: 'name', width: 70 },
                { name: 'amount', index: 'amount', width: 100, formatter: 'number', align: 'right' },
                { name: 'tax', index: 'tax', width: 70, formatter: 'number', align: 'right' },
                { name: 'total', index: 'total', width: 120, formatter: 'number', align: 'right' },
                {
                    name: 'closed', index: 'closed', width: 110, align: 'center', formatter: 'checkbox',
                    edittype: 'checkbox', editoptions: { value: 'Yes:No', defaultValue: 'Yes' },
                    stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: ':All;true:Yes;false:No' }
                },
                {
                    name: 'ship_via', index: 'ship_via', width: 120, align: 'center', formatter: 'select',
                    edittype: 'select', editoptions: { value: 'FE:FedEx;TN:TNT;IN:Intim', defaultValue: 'Intime' },
                    stype: 'select', searchoptions: { value: ':All;FE:FedEx;TN:TNT;IN:Intim' }
                },
                { name: 'note', index: 'note', width: 100, sortable: false }
            ],
            rowNum: 10,
            rowList: [5, 10, 20],
            //pager: '#pager',
            gridview: true,
            ignoreCase: true,
            rownumbers: false,
            sortname: 'invdate',
            viewrecords: true,
            sortorder: 'desc',
            //caption: 'Just simple local grid',
            height: '100%'
        });
        myGrid.jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" });

        myGrid.jqGrid('setGroupHeaders', {
            useColSpanStyle: true, groupHeaders:
                [
                    { startColumnName: 'invdate', numberOfColumns: 5, titleText: "Group column 1" },
                    { startColumnName: 'closed', numberOfColumns: 3, titleText: "Group column 2" },
                ]
        });

    });
如果只有一个标题分组级别,则网格工作正常

当我添加更多标题分组级别时,工具栏搜索出现问题

免费jqgrid的这两个特性之间有冲突吗


谁能帮我解决这个问题?非常感谢。

我可以确认,在您的参数组合中,
setGroupHeaders
的第二次调用在某些列上设置了错误的
rowspan
属性值。我可以建议您在调用
setGroupHeaders
后手动解决此问题。以你的身份

$(“#list_invdate,#list_closed,#list_ship_via,#list_note,#list_name”).attr(“rowspan”,“2”);

参见修改后的演示

我写了一个例子来描述这个问题:我可以在配置中用set
rowspan
来解决这个问题吗?我为两组设置
useColspan style=false
,然后就可以了。这是正确的解决方案吗?@Tommy1209:你指的是哪个“配置”?如果使用
useColspan style:true
setGroupHeaders
仅基于上次调用的
groupHeaders
选项计算
rowspan
值。我们可以看出,你的计算是错误的。您当然可以使用
useColSpanStyle:false
,但您将看到网格标题的另一个外观。这是你想要的吗?或者,您可以像我建议的那样修复
行span
的值。现在网格标题的最终外观应该是正确的。在我看来,这是最好的解决办法,我可以建议你。我理解你,奥列格。我将应用你的建议来解决我的问题。非常感谢你!祝你今天愉快,奥列格@汤姆1209:不客气!祝你今天愉快,汤米。