jqgrid简单学习笔记_jquery
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了jqgrid简单学习笔记_jquery,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3573字,纯文字阅读大概需要6分钟。
内容图文
![jqgrid简单学习笔记_jquery](/upload/InfoBanner/zyjiaocheng/314/d276cd1dab62494c92c4ab599a77fa78.jpg)
JqGrid Demo:http://trirand.com/blog/jqgrid/jqgrid.html#t107
JqGrid的基础,我这里就不做介绍了,不知道的可以去看看博客园或Google,最好去看文档。先看效果图:
本Demo可以查询、修改、分组。新增、删除等一些基本功能都可以去JqGrid Demo中找到。
逻辑思路:第一次加载本年度的经营计划数据,加载完成后,将JqGrid设置成本地数据,这样分页、数据查询都成customs。只能修改本月以后的计划,在afterShowForm和afterclickPgButtons做验证,如果时间小于等于本月,这将提交按钮设置成disabled。否则提交按钮可以使用。在提交服务器前,需要将JqGrid的datatype设置成json,否则不会请求服务器。
本Demo只做了2010、2011、2012年三个静态数据源,修改数据只做了返回信息,并没修改数据源数据。
Apsx页面代码:
Javascript中JqGrid的配置代码:
jQuery("#jqgridlist").jqGrid({ url: 'DataHandler.ashx',
datatype: function (pdata) {
$.ajax({ url: 'DataHandler.ashx',
dataType: "json", type: "post",
contentType: "application/x-www-form-urlencoded; charset=utf-8",
data: pdata,
error: function (data, status, statusText) {
if (!(status == 200 && statusText == "parsererror"))
alert("客服端解析数据错误!\n请与管理员联系");
else
alert"请求服务器错误!\n请稍后再试或与管理员联系");
},
complete: function (jsondata, stat) {
if (stat == "success") {
var thegrid = jQuery("#jqgridlist")[0],
data = eval("(" + jsondata.responseText + ")");
thegrid.addJSONData(data);
data = null;
jsondata = null;
}
}
});
},
colNames: ["行号", "日期期间", "c_code", "单位名称", "销售回款", "营业收入", "工业总产值", "利润总额", "上交税金"],
colModel: [{ name: "ROWNUM", index: "ROWNUM", editable: false, summaryType: 'count',
summaryTpl: '({0}) total'
},
{ name: "JHQJ", index: "JHQJ", editable: true, stype: 'text', search: true, searchoptions: { sopt: ['eq'] },
editoptions: { style: "border:0; background-color:transparent;" }
},
{ name: "C_CODE", index: "C_CODE", sortable: false, editable: true, search: false, hidden: true,
editrules: { edithidden: false }, editoptions: { style: "border:0; background-color:transparent;" }
},
{ name: "DWJC", index: "DWJC", editable: true, search: true, stype: 'text', searchoptions: { sopt: ['cn'] },
editoptions: { style: "border:0; background-color:transparent;" }
},
{ name: "a21", index: "a21", editable: true, search: true, editrules: { number: true },
formatter: 'currency', summaryType: 'sum'
},
{ name: "a22", index: "a22", editable: true, search: true, editrules: { number: true },
formatter: 'currency', summaryType: 'sum'
},
{ name: "a23", index: "a23", editable: true, search: true, editrules: { number: true },
formatter: 'currency', summaryType: 'sum'
},
{ name: "a24", index: "a24", editable: true, search: true, editrules: { number: true },
formatter: 'currency', summaryType: 'sum'
},
{ name: "a25", index: "a25", editable: true, search: true, editrules: { number: true },
formatter: 'currency', summaryType: 'sum'
}
],
height: 400,
autowidth: true,
width: 700,
rowNum: 70,
rowTotal: 1300,
rowList: [13, 70, 100],
rownumbers: false,
loadonce: true,
loadtext: '載入中...',
forceFit: true,
gridview: true,
pager: '#pager',
sortname: 'ROWNUM',
scroll: 0,
page: 1,
viewrecords: true,
editurl: 'DataHandler.ashx',
sortorder: "asc",
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false
},
grouping: false,
groupingView: {
groupField: ['DWJC'],
groupColumnShow: [true],
groupText: ['{0}'],
groupCollapse: false,
groupOrder: ['asc'],
groupSummary: [false],
groupDataSorted: true
},
gridComplete: function () {
$("#jqgridlist").setGridParam({ datatype: 'local' });
},
caption: "
分组: |
});
内容总结
以上是互联网集市为您收集整理的jqgrid简单学习笔记_jquery全部内容,希望文章能够帮你解决jqgrid简单学习笔记_jquery所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。