index2.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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:'id',index:'id',width:50,sortable: false},
  32. {label:'名称',name:'title',index:'title', sortable: false},
  33. {label:'模板',name:'temp_title',index:'temp_title', sortable: false},
  34. {label:'备注',name:'remark',index:'remark', sortable: false},
  35. {label:'操作',width:80,sortable: false,formatter: function (a, b, c) {
  36. var editurl = "{:url('add',[],'')}/id/"+c.id;
  37. var delurl = "{:url('del',[],'')}/id/"+c.id;
  38. var btn = '<a target="_blank" href="'+c.surl+'"><span class="label label-info" title="查看">查看</span></a>&nbsp;';
  39. btn += '<a href="'+editurl+'"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  40. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  41. return btn;
  42. }},
  43. ],
  44. rowNum:10,
  45. rowList:[10,20,30,50,100],
  46. pager: '#pager',
  47. sortname: 'sort',
  48. viewrecords: true,
  49. autowidth:true,
  50. mtype: 'post',
  51. height: 'auto',
  52. emptyrecords: "暂无数据",
  53. sortorder: "asc",
  54. caption:"大屏列表",
  55. loadComplete: function (xhr) {
  56. if(xhr.code==0){
  57. layer.msg(xhr.msg);
  58. return false;
  59. }
  60. },
  61. });
  62. });
  63. </script>
  64. {/block}