从主网格详细加载jqGrid数据时出现问题? [英] problem loading data in details jqGrid from master grid?

查看:108
本文介绍了从主网格详细加载jqGrid数据时出现问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我第一次打电话时,它在主网格中的我的详细信息网格中显示数据,但是在选择其他行时,它没有在详细信息网格中填充新数据.

When I am making a call first time it shows data in my details grid from master grid but when selecting other row its not populating the new data in the details grid..

jQuery("#list10").jqGrid({
    sortable: true,
    url: '/cpsb/unprocessedOrders.do?method=getInitialUnprocessedList',
    datatype: 'json',
    colNames: ['Order', 'Load', 'Gate Time', 'Stop', 'Customer', 'Status'],
    colModel: [
        { name: 'orderNumber', index: 'orderNumber', width: 120, align: "center",
          sorttype: "int", key: true },
        { name: 'loadNumber', index: 'loadNumber', width: 100, align: "center",
          sorttype: "int" },
        { name: 'latestTime', index: 'latestTime', width: 160, align: "center",
          align: "center" },
        { name: 'stopSeq', index: 'stopSeq', width: 80, align: "center",
          sorttype: "int" },
        { name: 'customerNumber', index: 'customerNumber', width: 60,
          align: "center", sorttype: "int" },
        { name: 'orderStatus', index: 'orderStatus', width: 120, align: "center" }
    ],
    rowNum: 10,
    rowList: [10, 20, 30],
    jsonReader: { repeatitems: false,
        root: function (obj) {
            return obj;
        },
        page: function (obj) { return 1; },
        total: function (obj) { return 1; },
        records: function (obj) { return obj.length; }
    },
    pager: '#pager10',
    sortname: 'Gate Time',
    sortorder: "desc",
    gridview: true,
    loadonce: true,
    viewrecords: true,
    multiselect: true,
    multikey: 'ctrlKey',
    caption: "Order Header",
    onSelectRow: function (ids) {
        if (ids == null) {
            ids = 0;
            if (jQuery("#list10_d").jqGrid('getGridParam', 'records') > 0) {
                jQuery("#list10_d").jqGrid('setGridParam', { url:
"/cpsb/unprocessedOrders.do?method=getUnprocessedOrderDetails&orderNum=" + ids });
                jQuery("#list10_d").jqGrid('setCaption',
                        "Order Header: " + ids).trigger('reloadGrid');
            }
        }
        else {
            jQuery("#list10_d").jqGrid('setGridParam', { url:
"/cpsb/unprocessedOrders.do?method=getUnprocessedOrderDetails&orderNum=" + ids });
            jQuery("#list10_d").jqGrid('setCaption',
                      "Order Details: " + ids).trigger('reloadGrid');
        }
    },
    height: '100%'
}); 
jQuery("#list10").jqGrid('navGrid','#pager10',
       {view:true,add:false,edit:false,del:false,searchtext:"Filter"},
       {},{},{},{multipleSearch:true});
$("#list10").jqGrid('hideCol', 'cb');

第二个网格以获取订单详细信息

2nd grid for order details

jQuery("#list10").jqGrid('reloadGrid');
jQuery("#list10_d").jqGrid({
    height: 100,
    url: "/cpsb/unprocessedOrders.do?method=getUnprocessedOrderDetails&orderNum=",
    datatype: "json",
    colNames: ['Order', 'SKU', 'UPC', 'Item Description', 'Quantity Ordered',
               'Teach in Hold?'],
    colModel: [
        { name: 'orderNumber', index: 'orderNumber', width: 55 },
        { name: 'sku', index: 'sku', width: 55 },
        { name: 'upc', index: 'upc', width: 40, align: "right" },
        { name: 'itemDescription', index: 'itemDescription', width: 150,
          align: "right" },
        { name: 'quantityOrdered', index: 'quantityOrdered', width: 150,
          align: "right", sortable: false, search: false },
        { name: 'teachInId', index: 'teachInId', width: 150,
          align: "right", editable: true, edittype: "checkbox",
          formatter: 'checkbox', editoptions: { value: "true:false"} }],
    rowNum: 5,
    rowList: [5, 10, 20],
    jsonReader: { repeatitems: false,
        root: function (obj) {
            return obj;
        },
        page: function (obj) { return 1; },
        total: function (obj) { return 1; },
        records: function (obj) { return obj.length; }
    },
    pager: '#pager10_d',
    sortname: 'SKU',
    loadonce: true,
    viewrecords: true,
    sortorder: "asc",
    multiselect: true,
    multikey: 'ctrlKey',
    caption: "Order Detail",
    height: '100%'
}).navGrid('#pager10_d', { view: true, add: false, edit: false, del: false },
            {}, {}, {}, { multipleSearch: true });
$("#list10_d").jqGrid('hideCol', 'cb');
jQuery("#ms1").click(function () {
    var s;
    s = jQuery("#list10_d").jqGrid('getGridParam', 'selarrrow');
    alert(s);
});

刷新页面后,我可以查看不同的记录...但是选择一个后,其他选择不起作用

I am able view different records once I refresh the page...But after one selection other selection don't work

edit2:调试后,我看到我正确地添加了orderNum参数,但这没有对操作类进行任何调用.谢谢!

edit2: after debugging i saw that I am appending the orderNum parameter correctly but this is not making any call to the action class....any idea? thanks!

推荐答案

在我看来,您在这里遇到的主要问题的答案是:

It seems to me that the answer on your main problem you find here: JqGrid Reload not working.

因为在两个网格中都使用loadonce:true,所以在第一次加载后,每个网格中的datatype将从"json"更改为"local".在我看来,您应该只删除第二个(详细)网格的loadonce:true.例如,如果确实要使用loadonce:true进行本地排序或本地分页,则应在同一调用jQuery("#list10_d").jqGrid('setGridParam',{url:"...", datatype: "json"});中将datatype重置为"json".

Because you use loadonce:true in both grids, the datatype in every grid will be changed from "json" to "local" after the first load. It seems to me that you should just remove loadonce:true for the second (detailed) grid. If you do want use loadonce:true for example for local sorting or local paging, then you should reset datatype to "json" in the same call jQuery("#list10_d").jqGrid('setGridParam',{url:"...", datatype: "json"}); .

这篇关于从主网格详细加载jqGrid数据时出现问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆