record.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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('index')}" 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('record',['id'=>$id])}",
  29. datatype: "json",
  30. colModel:[
  31. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  32. {label:'昵称',name:'user_id',index:'user_id',width:80,editable: false,sortable: false,
  33. formatter:function (a,b,c){
  34. return '游客';
  35. }},
  36. {label:'ip',name:'ip',index:'ip',width:80,editable: false,sortable: false},
  37. {label:'创建时间',name:'create_time',index:'create_time',width:60,sortable: true},
  38. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  39. var info_url = "{:url('info',[],'')}/id/"+c.id;
  40. var btn = '<a url="'+info_url+'" href="javascript:;" data-title="详情" onclick="layer_open(this,1)"><span class="label label-primary" title="详情">详情</span></a>';
  41. return btn;
  42. }},
  43. ],
  44. rowNum:10,
  45. rowList:[10,20,30,50,100],
  46. pager: '#pager',
  47. sortname: 'id',
  48. viewrecords: true,
  49. autowidth:true,
  50. mtype: 'post',
  51. height: 'auto',
  52. emptyrecords: "暂无数据",
  53. sortorder: "desc",
  54. caption:"{$m_name}列表",
  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}