index.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="ibox">
  4. <div class="ibox-content">
  5. </div>
  6. <div class="ibox-content">
  7. <div class="jqGrid_wrapper">
  8. <table id="table" style="border-collapse: collapse"></table>
  9. <div id="pager"></div>
  10. </div>
  11. </div>
  12. </div>
  13. {/block}
  14. {block name="script"}
  15. <script>
  16. $(function () {
  17. $(window).bind("resize",function(){
  18. var width=$(".jqGrid_wrapper").width();
  19. $("#table").setGridWidth(width);
  20. });
  21. $.jgrid.defaults.styleUI="Bootstrap";
  22. $("#table").jqGrid({
  23. url:"{:url('index')}",
  24. datatype: "json",
  25. colModel:[
  26. {label:'数值',name:'num',index:'num',width:80,editable: false,sortable: false},
  27. {label:'时间',name:'add_time',index:'add_time',width:80,editable: false,sortable: false},
  28. ],
  29. rowNum:10,
  30. rowList:[10,20,30,50,100],
  31. pager: '#pager',
  32. sortname: 'id',
  33. viewrecords: true,
  34. autowidth:true,
  35. mtype: 'post',
  36. height: 'auto',
  37. emptyrecords: "暂无数据",
  38. sortorder: "desc",
  39. caption:"{$meta_title}",
  40. loadComplete: function (xhr) {
  41. if(xhr.code==0){
  42. layer.msg(xhr.msg);
  43. return false;
  44. }
  45. },
  46. });
  47. });
  48. </script>
  49. {/block}