pages.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <div class="table-responsive">
  2. <div id="toolbar" class="toolbar">
  3. <a href="javascript:;" class="btn btn-primary" title="{:__('Refresh')}" onclick="location.reload();"><i class="fa fa-refresh"></i> </a>
  4. </div>
  5. <table class="table table-striped table-bordered table-hover table-nowrap" id="table">
  6. </table>
  7. </div>
  8. <!--@formatter:off-->
  9. <script>
  10. require.callback = function () {
  11. define('backend/cms/ajax', ['jquery', 'bootstrap', 'backend', 'table', 'template'], function ($, undefined, Backend, Table, Template) {
  12. var Controller = {
  13. get_page_list: function () {
  14. var table = $("#table");
  15. // 初始化表格
  16. table.bootstrapTable({
  17. toolbar: ".toolbar", //工具栏
  18. search: true, //是否启用快速搜索
  19. cache: false,
  20. pageSize: 10,
  21. pagination: true,
  22. pageList: [10, 15, 20, 25, 50, 'All'],
  23. columns: [{
  24. field: 'path',
  25. title: '路径',
  26. width:'40%',
  27. formatter:function (value, row, index) {
  28. return '<input type="text" class="form-control" value="' + value + '" />';
  29. }
  30. }, {
  31. field: 'name',
  32. title: '名称',
  33. width:'45%',
  34. align:'center',
  35. valign: 'middle',
  36. }, {
  37. field: 'operate',
  38. title: '操作',
  39. align:'center',
  40. width:'15%',
  41. valign: 'middle',
  42. formatter:function (value, row, index) {
  43. return '<a href="javascript:" class="btn btn-success btn-xs btn-selectit">选择</a>';
  44. }
  45. }],
  46. data: {$pageList|json_encode}
  47. });
  48. $(document).on("click", ".btn-selectit", function () {
  49. Fast.api.close($(this).parent().prev().prev().find("input").val());
  50. return false;
  51. });
  52. }
  53. };
  54. return Controller;
  55. });
  56. }
  57. </script>
  58. <!--@formatter:on-->