jqgrid ajax加载
来源:互联网 发布:跳蚤街二手市场软件 编辑:程序博客网 时间:2024/06/17 09:08
第一种local
//初始化 var _getData = function(){ _putGrid(); $.ajax({ url :urlPath.kafkaMonitorUrl, dataType :'json', //type : "POST", async : false, success : function(result) { if (result["code"] === 200){ _putGrid(result["Result"]); }else { Messager.alert({ Msg: result["msg"], iconImg: "warning", isModal: false }); } } }); }; //数据装入表格 var _putGrid = function (gridData) { //加载jar包列表 $("#moduleListTable").jqGrid({ //url : urlPath.kafkaMonitorUrl, //mtype : "POST", //datatype : "JSON", datatype : "local", data : gridData, colModel : [ { label : "Id", name : "moduleId", key : true, hidden : true }, { label : "协议类型", name : "topic", sortable:true, align:"center" },{ label : "当前接入速度", name : "BytesOutPerSec", sortable:true, align:"center" },{ label : "当前接入量", name : "BytesOutCount", sortable:true, align:"center" },{ label : "历史接入量", name : "BytesOutPerDay", sortable:true, align:"center" } ], loadonce : false, forceFit: true, viewrecords : true, autowidth : true, height : false, rownumbers : true, multiselect : false, multiboxonly : true, rowNum : 10, // 每页显示记录数 rowList : [10, 15, 20 ], // 用于改变显示行数的下拉列表框的元素数组 pager : "#moduleListPage" }); $("#moduleListTable").jqGrid({autowidth:false}).setGridWidth($(window).width()-300); }; var _reloadGrid = function(){ $("#moduleListTable").trigger("reloadGrid") };
第二种直接装
initialization:function () { $("#systemNoticeTabel").jqGrid({ url : systemNotice.config.systemNoticeInitializationUrl, mtype : "POST", datatype : "JSON", sortorder: "desc", colNames : ["公告标题","公告类型","公告内容","发布时间","状态"], colModel : [ {name:"title",index:"title",align:"center",width:"30px",sortable:true, formatter:function(cellvalue, options, rowObject){ var titleType = ""; if(1 == rowObject.important){ titleType = "<font color=red>★</font>"+cellvalue; }else{ titleType = cellvalue; } return titleType; }}, {name:"important",index:"important",align:"center",width:"20px",sortable:true, formatter:function(cellvalue, options, rowObject){ var type = ""; if(0 == cellvalue){ type = "一般公告"; }else if(1 == cellvalue){ type = "重要公告"; } return type; } }, {name:"content",index:"content",align:"center",width:"30px",sortable:true}, {name:"createTime",index:"create_time",align:"center",width:"20px",sortable:true}, {name:"status",index:"4",align:"center",width:"20px",hidden : true,sortable:false} ], /*表格加载完成后执行的函数*/ gridComplete:function(){ var rowids = $("#systemNoticeTabel").jqGrid('getDataIDs'); for(var i = 0;i < rowids.length; i++){ var allrowIds = []; allrowIds[i]=rowids[i]; var allrowDatas = $("#systemNoticeTabel").jqGrid('getRowData',rowids[i]); var allrowdatStatus = allrowDatas.status; if(allrowdatStatus == "140001001"){ $("#"+allrowIds[i]).find("td").css("color","red"); $("#"+allrowIds[i]).find("td").css("font-weight","bold"); }else{ $("#"+allrowIds[i]).find("td").css("color","#333"); $("#"+allrowIds[i]).find("td").css("font-weight","normal"); } } }, loadonce : false, forceFit: true, viewrecords : true, autowidth : true, height : false, rownumbers : true, multiselect : true, multiboxonly : true, rowNum : 10, // 每页显示记录数 rowList : [10, 15, 20 ], // 用于改变显示行数的下拉列表框的元素数组 pager : "#systemNoticePage", }); //jqGrid自适应宽度 $(window).resize(function(){ $("#systemNoticeTabel").jqGrid({autowidth:false}).setGridWidth($(window).width()); });
阅读全文
0 0
- jqgrid ajax加载
- jqgrid加载数据
- jqGrid - 重新加载数据
- jqgrid 重新加载数据.
- jqGrid之重新加载数据
- jqgrid select数据加载数据
- jqgrid 树形菜单递归加载
- jqgrid加载本地数据分页
- jqgrid treegrid 重新加载数据
- jqgrid使用ajax获取数据赋值
- jqGrid初始化加载本地json数据
- JQGrid二种方法加载Json数据
- jqgrid 加载本地数据local 如何分页
- jqgrid实现前台动态加载列
- JQGrid 在页面加载时展开SubGrid
- jqgrid刷新列表,重新加载数据
- 关于jqGrid表格重新加载的问题
- jqGrid 初始化列表时,不加载数据
- 微信开发必备外网映射工具----Ngroke
- 【Caffe特征图可视化】【权重图weight】【特征图feat】
- 你不知道的CSS3选择器--精辟用法
- Android Chronometer类
- 4.3(4)
- jqgrid ajax加载
- linux 如何显示一个文件的某几行(中间几行)
- SequenceInputStream合并流
- Git版本冲突
- Caffe、TensorFlow、MXnet三个开源库对比
- 设计模式笔记之装饰模式---变继承关系为组合关系
- 切换fragment
- 作业2
- MyBatis插件使用--通用Mapper