index.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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:'title',index:'title', width:70,sortable: false},
  32. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  33. var editurl = "{:url('add',[],'')}/id/"+c.id;
  34. var delurl = "{:url('del',[],'')}/id/"+c.id;
  35. 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;';
  36. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  37. return btn;
  38. }},
  39. ],
  40. rowNum:10,
  41. rowList:[10,20,30,50,100],
  42. pager: '#pager',
  43. sortname: 'sort',
  44. viewrecords: true,
  45. autowidth:true,
  46. mtype: 'post',
  47. height: 'auto',
  48. emptyrecords: "暂无数据",
  49. sortorder: "asc",
  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}