0
0

index.html 2.4 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="javascript:;" url="{:url('add')}" data-title="新增" onclick="layer_open(this,1)" data-width="400px" data-height="300px" 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:40,sortable: false},
  32. {label:'名称',name:'title',index:'title', width:70,sortable: false},
  33. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  34. var editurl = "{:url('add',[],'')}/id/"+c.id;
  35. var delurl = "{:url('del',[],'')}/id/"+c.id;
  36. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)" data-width="400px" data-height="300px" ><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  37. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  38. return btn;
  39. }},
  40. ],
  41. rowNum:10,
  42. rowList:[10,20,30,50,100],
  43. pager: '#pager',
  44. sortname: 'sort',
  45. viewrecords: true,
  46. autowidth:true,
  47. mtype: 'post',
  48. height: 'auto',
  49. emptyrecords: "暂无数据",
  50. sortorder: "asc",
  51. caption:"添加方式列表",
  52. loadComplete: function (xhr) {
  53. if(xhr.code==0){
  54. layer.msg(xhr.msg);
  55. return false;
  56. }
  57. },
  58. });
  59. });
  60. </script>
  61. {/block}