jqGrid 學習筆記--資料非同步載入方法 隨筆1

來源:互聯網
上載者:User

var commonQuery = '../importantInfoReport/pageQueryImportantInfoReport.action?type=0'; 
    jQuery("#listImportInfoReport").jqGrid ({ 
        rowNum : 10, 
        type:'POST', 
        pager : '#pagerImportantInfoReport', 
        viewrecords : true, 
        multiselect: true, 
        width: defaultGridWidth, 
        height : defaultGridHeight, 
        url: commonQuery, 
        datatype : "json", 
        jsonReader: {  
          root:"dataRows", page:"page", total:"total", records:"records", repeatitems:false, id : "id" 
        }, 
        colNames : [ 
            'ID', 
            '事件名稱', 
            '事件等級', 
            '進展情況', 
            '接收範圍', 
            '報送人', 
            '報送時間', 
            '操作' 
        ], 
        colModel : [ 
            {name:'id', label:'ID', index:'id',hidden:true} 
            , {name:'eventName', label:'事件名稱', index:'eventName', width:100} 
            , {name:'state', label:'事件等級', index:'state',hidden:true} 
            , {name:'progress', label:'進展情況', index:'progress', width:100} 
            , {name:'receiver', label:'接收範圍', index:'receiver', width:150} 
            , {name:'sendor', label:'報送人', index:'sendor',hidden:true} 
            , {name:'createTime', label:'報送時間', index:'createTime',formatter:'date',formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d H:i:s'}, width:70} 
            , {name:'action', index:'action',align:"center", width:60} 
        ], 
        sortname: 'id', 
        sortorder:  'desc', 
        gridComplete : function() { 
            var ids=jQuery("#listImportInfoReport").jqGrid('getDataIDs'); 
            for(var i=0;i<ids.length;i++) 
            { 
                var cl = ids[i]; 
                //alert(cl); 
                var rowdata=jQuery("#listImportInfoReport").jqGrid('getRowData',cl); 
                //執行個體ID 
                var Id=rowdata["id"];                
                be = "<input style='height:22px;width:40px;' type='button' value='查看' onclick='javascript:viewImportantInfoReportById(" + Id +")'/>";  
                del = "<input style='height:22px;width:40px;' type='button' value='刪除' onclick='javascript:delImportantInfoReportById(" + Id +")'/>";      
                jQuery("#listImportInfoReport").jqGrid('setRowData',ids[i],{action:be+del}); 
            } 
        }, 
        onSelectRow: function(id){ 
             
        } 
    }); 
    jQuery("#listImportInfoReport").jqGrid('navGrid', "#pagerImportantInfoReport", { 
        edit : false, add : false, del : false, multipleSearch : false, search : false 
    }); 

摘自 Hurry的專欄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.