1. 程式人生 > >bootstrap-table自己配置

bootstrap-table自己配置

urn sortable rac var highlight fine attribute 按鈕 屬性

  1. function initTable(){
  2. var methodNameSearch=$("#methodNameSearch").val();
  3. var requestUrl = "/manage/json/validateMethodDefineSearchList.json?methodNameSearch=" + methodNameSearch;
  4. var $table = $(‘#table‘);
  5. $table.bootstrapTable({
  6. url: requestUrl,
  7. method: ‘get‘, //請求方式(*)
  8. //toolbar: ‘#toolbar‘, //工具按鈕用哪個容器
  9. striped: true, //是否顯示行間隔色
  10. cache: false, //是否使用緩存,默認為true,所以一般情況下需要設置一下這個屬性(*)
  11. pagination: true, //是否顯示分頁(*)
  12. sortable: false, //是否啟用排序
  13. sortOrder: "asc", //排序方式
  14. //queryParams: queryParams,//傳遞參數(*)
  15. pageNumber:1, //初始化加載第一頁,默認第一頁
  16. pageSize: 20, //每頁的記錄行數(*)
  17. pageList: [10, 20, 50, 100], //可供選擇的每頁的行數(*)
  18. //search: true, //是否顯示表格搜索,此搜索是客戶端搜索,不會進服務端
  19. //strictSearch: true,
  20. //showColumns: true, //是否顯示所有的列
  21. //showRefresh: true, //是否顯示刷新按鈕
  22. minimumCountColumns: 2, //最少允許的列數
  23. clickToSelect: true, //是否啟用點擊選中行
  24. uniqueId: "id", //每一行的唯一標識,一般為主鍵列
  25. showToggle:false, //是否顯示詳細視圖和列表視圖的切換按鈕
  26. sidePagination: "server", //服務端處理分頁
  27. columns: [
  28. {title: ‘id‘,field: ‘id‘, visible: false, align: ‘center‘,valign: ‘middle‘},
  29. {title: ‘名稱‘,field: ‘methodName‘,align: ‘center‘,valign: ‘middle‘},
  30. {title: ‘<span style="font-family:Microsoft YaHei;">類名</span>‘,field: ‘methodCode‘,align: ‘center‘,valign: ‘middle‘},
  31. {title: ‘組名隱藏‘,field: ‘methodGroup‘, visible: false, align: ‘center‘,valign: ‘middle‘},
  32. {title: ‘組名‘,field: ‘methodGroupName‘,align: ‘center‘,valign: ‘middle‘},
  33. {title: ‘操作‘,field: ‘#‘,align: ‘center‘,
  34. formatter:function(value,row,index){
  35. var e = ‘<a href="#" mce_href="#" onclick="onEditClick(\‘‘+ row.id + ‘\‘,\‘‘ +row.methodName+ ‘\‘,\‘‘ +row.methodCode+ ‘\‘,\‘‘ +row.methodGroup+‘\‘)">編輯</a> ‘;
  36. var d = ‘<a href="#" mce_href="#" onclick="onDeleteClick(\‘‘+ row.id +‘\‘)">刪除</a> ‘;
  37. return e+d;
  38. }
  39. }
  40. ]
  41. });
  42. }



[html] view plain copy
    1. function onEditClick(id, methodName, methodCode, methodGroup) {
    2. var requestUrl = "/manage/validateMethodDefineAdd.vm?validateMethodDefineId=" + id
    3. +"&methodName=" + methodName+"&methodCode=" + methodCode+"&methodGroup=" + methodGroup;
    4. window.location = requestUrl;
    5. }

bootstrap-table自己配置