PingAnYeXianSZCG_Web 前端代码

table_jqgrid.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. <!DOCTYPE html>
  2. <html>
  3. <!-- Mirrored from www.zi-han.net/theme/hplus/table_jqgrid.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:02 GMT -->
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>H+ 后台主题UI框架 - jqGird</title>
  8. <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
  9. <meta name="description" content="H+是一个完全响应式,基于Bootstrap3最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术">
  10. <link rel="shortcut icon" href="favicon.ico"> <link href="./css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
  11. <link href="./css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
  12. <!-- jqgrid-->
  13. <link href="./css/plugins/jqgrid/ui.jqgridffe4.css?0820" rel="stylesheet">
  14. <link href="./css/animate.min.css" rel="stylesheet">
  15. <link href="./css/style.min862f.css?v=4.1.0" rel="stylesheet">
  16. <style>
  17. /* Additional style to fix warning dialog position */
  18. #alertmod_table_list_2 {
  19. top: 900px !important;
  20. }
  21. </style>
  22. </head>
  23. <body class="gray-bg">
  24. <div class="wrapper wrapper-content animated fadeInRight">
  25. <div class="row">
  26. <div class="col-sm-12">
  27. <div class="ibox ">
  28. <div class="ibox-title">
  29. <h5>jQuery Grid Plugin – jqGrid</h5>
  30. </div>
  31. <div class="ibox-content">
  32. <!--<p>
  33. <strong>jqGrid</strong> 是一个用来显示网格数据的jQuery插件,文档比较全面,附带中文版本。访问<a target="_blank" href="http://www.trirand.com/blog/"> 官网</a>
  34. </p>
  35. <p>jqGrid的主要特点为:</p>
  36. <ol>
  37. <li>基于jquery UI主题,开发者可以根据客户要求更换不同的主题</li>
  38. <li>兼容目前所有流行的web浏览器</li>
  39. <li>Ajax分页,可以控制每页显示的记录数</li>
  40. <li>支持XML,JSON,数组形式的数据源</li>
  41. <li>提供丰富的选项配置及方法事件接口</li>
  42. <li>支持表格排序,支持拖动列、隐藏列</li>
  43. <li>支持滚动加载数据</li>
  44. <li>支持实时编辑保存数据内容</li>
  45. <li>支持子表格及树形表格</li>
  46. <li>支持多语言</li>
  47. <li>免费</li>
  48. </ol>
  49. <hr>-->
  50. <!--<div class="jqGrid_wrapper">
  51. <table id="table_list_1"></table>
  52. <div id="pager_list_1"></div>
  53. </div>
  54. <p>&nbsp;</p>-->
  55. <h4 class="m-t">高级用法</h4>
  56. <div class="jqGrid_wrapper">
  57. <table id="table_list_2"></table>
  58. <div id="pager_list_2"></div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. <script src="./js/jquery.min.js?v=2.1.4"></script>
  66. <script src="./js/bootstrap.min.js?v=3.3.6"></script>
  67. <script src="./js/plugins/peity/jquery.peity.min.js"></script>
  68. <script src="./js/plugins/jqgrid/i18n/grid.locale-cnffe4.js?0820"></script>
  69. <script src="./js/plugins/jqgrid/jquery.jqGrid.minffe4.js?0820"></script>
  70. <script src="./js/content.min.js?v=1.0.0"></script>
  71. <script>
  72. $(document).ready(function() {
  73. $.jgrid.defaults.styleUI = "Bootstrap";
  74. var mydata = [{
  75. id: "1",
  76. invdate: "2010-05-24",
  77. name: "test",
  78. note: "note",
  79. tax: "10.00",
  80. total: "2111.00"
  81. }, {
  82. id: "2",
  83. invdate: "2010-05-25",
  84. name: "test2",
  85. note: "note2",
  86. tax: "20.00",
  87. total: "320.00"
  88. }, {
  89. id: "3",
  90. invdate: "2007-09-01",
  91. name: "test3",
  92. note: "note3",
  93. tax: "30.00",
  94. total: "430.00"
  95. }, {
  96. id: "4",
  97. invdate: "2007-10-04",
  98. name: "test",
  99. note: "note",
  100. tax: "10.00",
  101. total: "210.00"
  102. }, {
  103. id: "5",
  104. invdate: "2007-10-05",
  105. name: "test2",
  106. note: "note2",
  107. tax: "20.00",
  108. total: "320.00"
  109. }, {
  110. id: "6",
  111. invdate: "2007-09-06",
  112. name: "test3",
  113. note: "note3",
  114. tax: "30.00",
  115. total: "430.00"
  116. }, {
  117. id: "7",
  118. invdate: "2007-10-04",
  119. name: "test",
  120. note: "note",
  121. tax: "10.00",
  122. total: "210.00"
  123. }, {
  124. id: "8",
  125. invdate: "2007-10-03",
  126. name: "test2",
  127. note: "note2",
  128. amount: "300.00",
  129. tax: "21.00",
  130. total: "320.00"
  131. }, {
  132. id: "9",
  133. invdate: "2007-09-01",
  134. name: "test3",
  135. note: "note3",
  136. amount: "400.00",
  137. tax: "30.00",
  138. total: "430.00"
  139. }, {
  140. id: "11",
  141. invdate: "2007-10-01",
  142. name: "test",
  143. note: "note",
  144. amount: "200.00",
  145. tax: "10.00",
  146. total: "210.00"
  147. }, {
  148. id: "12",
  149. invdate: "2007-10-02",
  150. name: "test2",
  151. note: "note2",
  152. amount: "300.00",
  153. tax: "20.00",
  154. total: "320.00"
  155. }, {
  156. id: "13",
  157. invdate: "2007-09-01",
  158. name: "test3",
  159. note: "note3",
  160. amount: "400.00",
  161. tax: "30.00",
  162. total: "430.00"
  163. }, {
  164. id: "14",
  165. invdate: "2007-10-04",
  166. name: "test",
  167. note: "note",
  168. amount: "200.00",
  169. tax: "10.00",
  170. total: "210.00"
  171. }, {
  172. id: "15",
  173. invdate: "2007-10-05",
  174. name: "test2",
  175. note: "note2",
  176. amount: "300.00",
  177. tax: "20.00",
  178. total: "320.00"
  179. }, {
  180. id: "16",
  181. invdate: "2007-09-06",
  182. name: "test3",
  183. note: "note3",
  184. amount: "400.00",
  185. tax: "30.00",
  186. total: "430.00"
  187. }, {
  188. id: "17",
  189. invdate: "2007-10-04",
  190. name: "test",
  191. note: "note",
  192. amount: "200.00",
  193. tax: "10.00",
  194. total: "210.00"
  195. }, {
  196. id: "18",
  197. invdate: "2007-10-03",
  198. name: "test2",
  199. note: "note2",
  200. amount: "300.00",
  201. tax: "20.00",
  202. total: "320.00"
  203. }, {
  204. id: "19",
  205. invdate: "2007-09-01",
  206. name: "test3",
  207. note: "note3",
  208. amount: "400.00",
  209. tax: "30.00",
  210. total: "430.00"
  211. }, {
  212. id: "21",
  213. invdate: "2007-10-01",
  214. name: "test",
  215. note: "note",
  216. amount: "200.00",
  217. tax: "10.00",
  218. total: "210.00"
  219. }, {
  220. id: "22",
  221. invdate: "2007-10-02",
  222. name: "test2",
  223. note: "note2",
  224. amount: "300.00",
  225. tax: "20.00",
  226. total: "320.00"
  227. }, {
  228. id: "23",
  229. invdate: "2007-09-01",
  230. name: "test3",
  231. note: "note3",
  232. amount: "400.00",
  233. tax: "30.00",
  234. total: "430.00"
  235. }, {
  236. id: "24",
  237. invdate: "2007-10-04",
  238. name: "test",
  239. note: "note",
  240. amount: "200.00",
  241. tax: "10.00",
  242. total: "210.00"
  243. }, {
  244. id: "25",
  245. invdate: "2007-10-05",
  246. name: "test2",
  247. note: "note2",
  248. amount: "300.00",
  249. tax: "20.00",
  250. total: "320.00"
  251. }, {
  252. id: "26",
  253. invdate: "2007-09-06",
  254. name: "test3",
  255. note: "note3",
  256. amount: "400.00",
  257. tax: "30.00",
  258. total: "430.00"
  259. }, {
  260. id: "27",
  261. invdate: "2007-10-04",
  262. name: "test",
  263. note: "note",
  264. amount: "200.00",
  265. tax: "10.00",
  266. total: "210.00"
  267. }, {
  268. id: "28",
  269. invdate: "2007-10-03",
  270. name: "test2",
  271. note: "note2",
  272. amount: "300.00",
  273. tax: "20.00",
  274. total: "320.00"
  275. }, {
  276. id: "29",
  277. invdate: "2007-09-01",
  278. name: "test3",
  279. note: "note3",
  280. amount: "400.00",
  281. tax: "30.00",
  282. total: "430.00"
  283. }];
  284. $("#table_list_1").jqGrid({
  285. data: mydata,
  286. datatype: "local",
  287. height: 250,
  288. autowidth: true,
  289. shrinkToFit: true,
  290. rowNum: 14,
  291. rowList: [10, 20, 30],
  292. colNames: ["序号", "日期", "客户", "金额", "运费", "总额", "备注"],
  293. colModel: [{
  294. name: "id",
  295. index: "id",
  296. width: 60,
  297. sorttype: "int"
  298. }, {
  299. name: "invdate",
  300. index: "invdate",
  301. width: 90,
  302. sorttype: "date",
  303. formatter: "date"
  304. }, {
  305. name: "name",
  306. index: "name",
  307. width: 100
  308. }, {
  309. name: "amount",
  310. index: "amount",
  311. width: 80,
  312. align: "right",
  313. sorttype: "float",
  314. formatter: "number"
  315. }, {
  316. name: "tax",
  317. index: "tax",
  318. width: 80,
  319. align: "right",
  320. sorttype: "float"
  321. }, {
  322. name: "total",
  323. index: "total",
  324. width: 80,
  325. align: "right",
  326. sorttype: "float"
  327. }, {
  328. name: "note",
  329. index: "note",
  330. width: 150,
  331. sortable: false
  332. }],
  333. pager:"#pager_list_1",
  334. viewrecords: true,
  335. caption: "jqGrid 示例1",
  336. hidegrid: false
  337. });
  338. $("#table_list_2").jqGrid({
  339. data: mydata,
  340. datatype: "local",
  341. height: 450,
  342. autowidth: true,
  343. shrinkToFit: true,
  344. rowNum: 20,
  345. rowList: [10, 20, 30],
  346. colNames: ["序号", "日期", "客户", "金额", "运费", "总额", "备注"],
  347. colModel: [{
  348. name: "id",
  349. index: "id",
  350. editable: true,
  351. width: 60,
  352. sorttype: "int",
  353. search: true
  354. }, {
  355. name: "invdate",
  356. index: "invdate",
  357. editable: true,
  358. width: 90,
  359. sorttype: "date",
  360. formatter: "date"
  361. }, {
  362. name: "name",
  363. index: "name",
  364. editable: true,
  365. width: 100
  366. }, {
  367. name: "amount",
  368. index: "amount",
  369. editable: true,
  370. width: 80,
  371. align: "right",
  372. sorttype: "float",
  373. formatter: "number"
  374. }, {
  375. name: "tax",
  376. index: "tax",
  377. editable: true,
  378. width: 80,
  379. align: "right",
  380. sorttype: "float"
  381. }, {
  382. name: "total",
  383. index: "total",
  384. editable: true,
  385. width: 80,
  386. align: "right",
  387. sorttype: "float"
  388. }, {
  389. name: "note",
  390. index: "note",
  391. editable: true,
  392. width: 100,
  393. sortable: false
  394. }],
  395. pager: "#pager_list_2",
  396. viewrecords: true,
  397. caption: "jqGrid 示例2",
  398. add: true,
  399. edit: true,
  400. addtext: "Add",
  401. edittext: "Edit",
  402. hidegrid: false
  403. });
  404. $("#table_list_2").setSelection(4, true);
  405. $("#table_list_2").jqGrid("navGrid", "#pager_list_2", {
  406. edit: true,
  407. add: true,
  408. del: true,
  409. search: true
  410. }, {
  411. height: 200,
  412. reloadAfterSubmit: true
  413. });
  414. $(window).bind("resize", function() {
  415. var width = $(".jqGrid_wrapper").width();
  416. $("#table_list_2").setGridWidth(width)
  417. })
  418. });
  419. </script>
  420. <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
  421. </body>
  422. <!-- Mirrored from www.zi-han.net/theme/hplus/table_jqgrid.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:02 GMT -->
  423. </html>