JQ网格显示在帖子中加载

时间:2012-10-31 07:31:50

标签: jquery jqgrid

JQ Grid即使在Web服务返回正确的数据后也会显示加载。它可以工作3-4次,有时会继续显示加载对话框。 当我使用firebug进行交叉检查时,我的Web服务正在返回正确的数据。 我正在实现jqgrid的对话框,在jqgrid的document.ready()函数之后我正在形成用于jqgrid post的json请求。

function start(inputdata, pageNum, orderBy, orderWay,selectedfixtures) {    
var successdata="";         
        jQuery("#assignfixtureTable").jqGrid({     
            url: '<spring:url value="/services/org/profile/assignlist/${pid}"/>',
            userData: "userdata",               
            mtype: "POST",
            postData: {"selectedfixtures":selectedfixtures},
            datatype: "json",           
            autowidth: true,
            autoencode: true,   
            scrollOffset: 0,
            formatter: {
                 integer: {thousandsSeparator: ",", defaultValue: '0'},
                 number: {decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, defaultValue: '0.00'}
            },
            /* userData : "userdata", */
             forceFit: true,     
            colNames:["S No.","Fixture Name", "Template Name"  ,"Profile Name"   ],
            colModel:[
                {name:'sno', index:'sno', hidden:false, align:"left",sortable:false,width:"10%",search:false},
                {name:'fixtureName', index:'fixtureName', align:"left", sortable:false,width:"30%", search:false},
                {name:'templateName', index:'templateName',align:"left", sortable:false,width:"30%", searchoptions:{sopt:['cn']}},
                {name:'profileList',  index:'profileList',align:"left",sortable:false,width:"40%", edittype:"select",formatter:dropdownrenderer/* ,editoptions:{value:"ID:CHETAN"} */}

                ],             
            jsonReader: { 
                root:"assignFixtures", 
                page:"page", 
                total:"total", 
                records:"records",
                repeatitems:false,                  
                id : "sno"
            },
            multiselect: false,
            pager: '#assignfixturePagingDiv',
            page: pageNum,  
            sortorder: orderWay,
            sortname: orderBy,
            hidegrid: false,
            viewrecords: true,  
            onSortCol: function(index, iCol, sortOrder) {               
                $('#orderWay').attr('value', sortOrder);
                $('#orderBy').attr('value', index);
                ModifyGridDefaultStyles();
                forceFitFixtureTableHeight();
            },
            onPaging: function (pgButton)
            {
                ModifyGridDefaultStyles();
                forceFitFixtureTableHeight();
            },
            loadComplete: function(data) {
                if (data.assignFixtures != undefined) {
                    if (data.assignFixtures.length == undefined) {
                        // Hack: Currently, JSON serialization via jersey treats single item differently
                        jQuery("#assignfixtureTable").jqGrid('addRowData', 0, data.assignFixtures);
                    }
                }

            ModifyGridDefaultStyles();
            forceFitFixtureTableHeight();

            }
            });

}

0 个答案:

没有答案