1.生成代碼引入項目後
2. 首先 處理html代碼,在下面js里加入 以下代碼到圖中位置
detailView: true, onExpandRow: function (index, row, $detail) { initChildTable(index, row, $detail); },
3.在插入
initChildTable = function (index, row, $detail) { var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table'); $(childTable).bootstrapTable({ detailView: true, onExpandRow: function (index, row, $detail) { initChildTables(index, row, $detail); }, url: prefix + "/listPart", method: 'get', sidePagination: "server", contentType: "application/json;charset=UTF-8", queryParams: { tAreaParentId: row.tAreaId }, columns: [{ field: 'tAreaId', title: 'ID' }, { field: 'tAreaName', title: '名稱' }, { field: 'tStatus', title: '狀態', align: 'center', formatter: function (value, row, index) { return $.table.selectDictLabel(tStatusDatas, value); } }, { title: '操作', align: 'center', formatter: function (value, row, index) { var actions = []; actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" οnclick="$.operate.editTab(\'' + row.tAreaId + '\')"><i class="fa fa-edit"></i>編輯</a> '); actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" οnclick="$.operate.remove(\'' + row.tAreaId + '\')"><i class="fa fa-remove"></i>刪除</a>'); return actions.join(''); } }] }); }
4.html 就處理完了 具體參數根據實際情況更改
5.控制器
/** * 查詢 */ @GetMapping("/listPart" ) @ResponseBody public TableDataInfo listPart(Integer tAreaParentId) { startPage(); List<SysArea> list = sysAreaService.selectSysAreaParentList(tAreaParentId); return getDataTable(list); }
6.I***Service
7. ****impl
8. ***mapper
9. ***.xml 這裏就正常寫sql語句就好了
備註:只整明白了get請求,post請求沒搞懂,會的在下面評論啊