table_jqgrid.html 8.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>H+ 后台主题UI框架 - jqGird</title>
  7. <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
  8. <meta name="description" content="H+是一个完全响应式,基于Bootstrap3最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术">
  9. <link rel="shortcut icon" href="favicon.ico"> <link href="../css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  10. <link href="../css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
  11. <!-- jqgrid-->
  12. <link href="../css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
  13. <link href="../css/animate.min.css" rel="stylesheet">
  14. <link href="../css/style.min.css?v=4.1.0" rel="stylesheet">
  15. <style>
  16. /* Additional style to fix warning dialog position */
  17. #alertmod_table_list_2 {
  18. top: 900px !important;
  19. }
  20. </style>
  21. </head>
  22. <body class="gray-bg">
  23. <div class="wrapper wrapper-content animated fadeInRight">
  24. <div class="row">
  25. <div class="col-sm-12">
  26. <div class="ibox ">
  27. <div class="ibox-title">
  28. <h5>jQuery Grid Plugin – jqGrid</h5>
  29. </div>
  30. <div class="ibox-content">
  31. <p>
  32. <strong>jqGrid</strong> 是一个用来显示网格数据的jQuery插件,文档比较全面,附带中文版本。访问<a target="_blank" href="http://www.trirand.com/blog/"> 官网</a>
  33. </p>
  34. <p>jqGrid的主要特点为:</p>
  35. <ol>
  36. <li>基于jquery UI主题,开发者可以根据客户要求更换不同的主题</li>
  37. <li>兼容目前所有流行的web浏览器</li>
  38. <li>Ajax分页,可以控制每页显示的记录数</li>
  39. <li>支持XML,JSON,数组形式的数据源</li>
  40. <li>提供丰富的选项配置及方法事件接口</li>
  41. <li>支持表格排序,支持拖动列、隐藏列</li>
  42. <li>支持滚动加载数据</li>
  43. <li>支持实时编辑保存数据内容</li>
  44. <li>支持子表格及树形表格</li>
  45. <li>支持多语言</li>
  46. <li>免费</li>
  47. </ol>
  48. <hr>
  49. <h4>基本示例</h4>
  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-cn.js?0820"></script>
  69. <script src="../js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
  70. <script src="../js/content.min.js?v=1.0.0"></script>
  71. <script>
  72. $(document).ready(function(){$.jgrid.defaults.styleUI="Bootstrap";var mydata=[{id:"1",invdate:"2010-05-24",name:"test",note:"note",tax:"10.00",total:"2111.00"},{id:"2",invdate:"2010-05-25",name:"test2",note:"note2",tax:"20.00",total:"320.00"},{id:"3",invdate:"2007-09-01",name:"test3",note:"note3",tax:"30.00",total:"430.00"},{id:"4",invdate:"2007-10-04",name:"test",note:"note",tax:"10.00",total:"210.00"},{id:"5",invdate:"2007-10-05",name:"test2",note:"note2",tax:"20.00",total:"320.00"},{id:"6",invdate:"2007-09-06",name:"test3",note:"note3",tax:"30.00",total:"430.00"},{id:"7",invdate:"2007-10-04",name:"test",note:"note",tax:"10.00",total:"210.00"},{id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"21.00",total:"320.00"},{id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},{id:"11",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},{id:"12",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},{id:"13",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},{id:"14",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},{id:"15",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},{id:"16",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},{id:"17",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},{id:"18",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},{id:"19",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},{id:"21",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},{id:"22",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},{id:"23",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},{id:"24",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},{id:"25",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},{id:"26",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},{id:"27",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},{id:"28",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},{id:"29",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}];$("#table_list_1").jqGrid({data:mydata,datatype:"local",height:250,autowidth:true,shrinkToFit:true,rowNum:14,rowList:[10,20,30],colNames:["序号","日期","客户","金额","运费","总额","备注"],colModel:[{name:"id",index:"id",width:60,sorttype:"int"},{name:"invdate",index:"invdate",width:90,sorttype:"date",formatter:"date"},{name:"name",index:"name",width:100},{name:"amount",index:"amount",width:80,align:"right",sorttype:"float",formatter:"number"},{name:"tax",index:"tax",width:80,align:"right",sorttype:"float"},{name:"total",index:"total",width:80,align:"right",sorttype:"float"},{name:"note",index:"note",width:150,sortable:false}],pager:"#pager_list_1",viewrecords:true,caption:"jqGrid 示例1",hidegrid:false});$("#table_list_2").jqGrid({data:mydata,datatype:"local",height:450,autowidth:true,shrinkToFit:true,rowNum:20,rowList:[10,20,30],colNames:["序号","日期","客户","金额","运费","总额","备注"],colModel:[{name:"id",index:"id",editable:true,width:60,sorttype:"int",search:true},{name:"invdate",index:"invdate",editable:true,width:90,sorttype:"date",formatter:"date"},{name:"name",index:"name",editable:true,width:100},{name:"amount",index:"amount",editable:true,width:80,align:"right",sorttype:"float",formatter:"number"},{name:"tax",index:"tax",editable:true,width:80,align:"right",sorttype:"float"},{name:"total",index:"total",editable:true,width:80,align:"right",sorttype:"float"},{name:"note",index:"note",editable:true,width:100,sortable:false}],pager:"#pager_list_2",viewrecords:true,caption:"jqGrid 示例2",add:true,edit:true,addtext:"Add",edittext:"Edit",hidegrid:false});$("#table_list_2").setSelection(4,true);$("#table_list_2").jqGrid("navGrid","#pager_list_2",{edit:true,add:true,del:true,search:true},{height:200,reloadAfterSubmit:true});$(window).bind("resize",function(){var width=$(".jqGrid_wrapper").width();$("#table_list_1").setGridWidth(width);$("#table_list_2").setGridWidth(width)})});
  73. </script>
  74. </body>
  75. </html>