index.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="ibox">
  4. <div class="ibox-content">
  5. <div class="row">
  6. <div class="col-xs-3">
  7. <!-- <a href="{:url('add')}" class="btn btn-sm btn-primary">新增</a>-->
  8. </div>
  9. </div>
  10. </div>
  11. <div class="ibox-content">
  12. <div class="jqGrid_wrapper">
  13. <table id="table" style="border-collapse: collapse"></table>
  14. <div id="pager"></div>
  15. </div>
  16. </div>
  17. </div>
  18. {/block}
  19. {block name="script"}
  20. <script>
  21. $(function () {
  22. $(window).bind("resize",function(){
  23. var width=$(".jqGrid_wrapper").width();
  24. $("#table").setGridWidth(width);
  25. });
  26. $.jgrid.defaults.styleUI="Bootstrap";
  27. $("#table").jqGrid({
  28. url:"{:url('index')}",
  29. datatype: "json",
  30. colModel:[
  31. {label:'标题',name:'title',index:'title', width:60,sortable: false},
  32. {label:'标识',name:'name',index:'name', width:80,sortable: false},
  33. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  34. var editurl = "{:url('add',[],'')}/id/"+c.id;
  35. // var btn = '<a href="'+editurl+'"><span class="label label-info" title="编辑">编辑</span></a>&nbsp;';
  36. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  37. return btn;
  38. }},
  39. ],
  40. rowNum:10,
  41. rowList:[10,20,30,50,100],
  42. pager: '#pager',
  43. sortname: 'id',
  44. viewrecords: true,
  45. autowidth:true,
  46. mtype: 'post',
  47. height: 'auto',
  48. emptyrecords: "暂无数据",
  49. sortorder: "desc",
  50. caption:"系统文章列表",
  51. loadComplete: function (xhr) {
  52. if(xhr.code==0){
  53. layer.msg(xhr.msg);
  54. return false;
  55. }
  56. },
  57. });
  58. });
  59. </script>
  60. {/block}