有谁用到过jQuery表格插件ParamQuery,,最近项目特别需要做分页浏览,百度了下发现好多都是基本数据的显示,没有分页内容,现在需要做过这块示例,最好附下代码供学习使用。谢谢大家!
http://paramquery.com/demos/paging
官网最能解决
官网公司坑爹的网速上不去啊,,
如果只是分页浏览,下载demo基本都可以了,没看到哪里有说明给这个表格动态设置数据源,以及获取数据源的例子,lz要是解决了可以分享一下。
<script type="text/javascript">
$(function () {
FJListGrid();
});
function FJListGrid() {
var parm = "action=getFJXList&xmid=<%=projectid%>&fjr=<%=userid%>"; getAjax('../../dbHandler.ashx', parm, function (data) {
if (data == "") {
$("#grid_paging").html("暂无发件箱信息记录项");
return; }
var totalWidth = $("#grid_paging").width();
var json = eval("(" + data + ")");
var datalist = new Array();
for (var i = 0; i < json.Table.length; i++) {
var list = json.Table[i];
var tmplist = new Array(); tmplist.push(i + 1); tmplist.push(list.id); tmplist.push(list.xm_id); tmplist.push(list.NAME); tmplist.push(list.wjid); tmplist.push(list.msxx); datalist.push(tmplist); } var obj = {}; obj.colModel = [ { title: "序号", width: totalWidth * 0.1, dataType: "string", align: "left" }, { title: "文件收发编号", width: 1, dataType: "string", align: "center", hidden: true }, { title: "项目编号", width: 1, dataType: "string", align: "center", hidden: true }, { title: "收件人", width: totalWidth * 0.1, dataType: "string", align: "center"}, { title: "发件箱附件", width: totalWidth * 0.3, dataType: "string", align: "center", render: function (ui) { var rowData = ui.rowData; var value = rowData[4]; return "<img onclick=\"downloadFile('发件箱附件','" + value + "');\" title='点击查看附件详细信息' src='../../images/16/application_form_magnify.png' style='vertical-align:middle;cursor: pointer;' alt='' />"; } }, { title: "描述信息", width: totalWidth * 0.5, dataType: "string", align: "center", render: function (ui) { var rowData = ui.rowData; var curContent = rowData[4]; return "<MARQUEE><a style=\"cursor:default\">" + curContent + "</a></MARQUEE>"; } } ]; obj.dataModel = { data: datalist }; $("#grid_paging").pqGrid(obj); $("#grid_paging").pqGrid({ title: "<img src='../../Images/32/202323.png' width='25' height='25' style=\"vertical-align: middle;\" />发件箱信息列表", editable: false, numberCell: false, oddRowsHighlight: false, width: "100%", rowSelect: function (evt, ui) { GetRowIndex = ui.rowIndxPage; } }); pqGridResize("#grid_paging", -111, +15); }); }
/// <summary>
/// 获取发件箱信息列表
/// </summary>
/// <returns></returns>
public string getFJXList() { string xmid = HttpContext.Current.Request["xmid"]; string fjr = HttpContext.Current.Request["fjr"]; OperateDB db = new OperateDB("strConZJ"); string sql = "select a.*,b.NAME from wjsfjl as a left join USERS b on b.USERID=a.sjr where a.xm_id='" + xmid + "' and a.fjr='" + fjr + "'"; System.Data.DataSet ds = db.GetDataSet(sql); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { string jsonStr = ConvertJson.ToJson(ds); db.dispose(); return jsonStr; } } } return ""; }
现在想了解使用分页功能,但是下载demo打不开哇。。
@焰山寒客: 分页里面有访问google替换成本的的jquery和jquery ui库就可以了。
@焰山寒客: 官网最新的包已经是本地库了,可以打开啊
@清海扬波: 嗯,,我试试,,谢谢哈