這幾天由於業務需求,用到了jqgrid,用起來感覺很強大,提供了豐富的功能。也碰了不少壁。
問題:對於表字段少的,就直接用無影響,但是有的表字段很多,就導致顯示起來很別捏,如圖:
預設情況下是沒有開啟水平滾動條的,也就是說無論有多少字段,都會顯示在這一屏,這豈不是太操蛋?
解決:還好,官方提供了屬性開啟橫向滾動條,通過翻閱官方文件,發現
通過設定這兩個屬性:
shrinktofit:false,
autoscroll: true,
接著還要新增css樣式:$("#grid-table").jqgrid(/excel.do?method=getlist',
datatype: 'json',
mtype:'post',
colnames:['建設名稱','日期','設計單位','開工日期','建設位址','建設單位','發證機關','監理單位','竣工日期','證書編號','工程內容','施工單位'],
colmodel:[
//,
, ,,
,,
,
, ,,
,,],
imgpath: '',
rownum:50,
rowlist:[50,100,150],
pager: "#grid-pager",
altrows: true,
rownumbers:true,
multiselect: false,
multiboxonly:true,
viewrecords: true,
pagerpos:'left',
sortorder: "asc",
height: gridheight,
autowidth:true,
shrinktofit:false,
autoscroll: true, //開啟水平滾動條
postdata:,
loadcomplete : function() , 0);
},recordtext: " 顯示第 - 項紀錄, 共 項",
emptyrecords: "當前沒有對應記錄資訊",
loadtext: "賣力載入中...",
pgtext : " 頁 ,共 頁"
});
效果如下:
設定jqGrid水平滾動條
1.html設定css樣式 2.js設定 shrinktofit false,autoscroll true,開啟水平滾動條 table list 1 jqgrid colnames 日期 主播數 回放數量 違規 主播刪除 回放總時長 分鐘 總收入 作品總數 作品收益 colmodel rownum...
jqGrid元件顯示滾動條
如下為顯示滾動條的核心配置 shrinktofit false,autoscroll true,autowidth true,jqgrid closest ui jqgrid bdiv css 需要拖拉才能顯示水平滾動條 jqgrid closest ui jqgrid bdiv css 需要拖拉才...
水平拖動滾動條
這個過程分為三步走 一 分析首先獲取元素 記得onmousemove 一定要寫在onmousedown當中,善於利用var that this 在onmosedown中最為重要的是獲取移動的距離 首先是event.client leftval 的值 二 判斷移動的距離是否超出範圍,由於that.st...