1、问题重现:
后台返回的数据是这样的:
要做的效果就是头部固定,左列固定。
这里使用的插件库是 :tableHeaderFixer.js (找不到库文件,可以在下方留言)
2、需求实现:
将后台返回的数据展示在页面上,无法设置td th的宽度?
记得用min-width这个属性!
$("#CapitalTable").html(fundsRaised);
$("#CapitalTable>table").tableHeadFixer({ "left": 1 });
$("#CapitalTable>table>thead>tr>th:nth-of-type(1)").css({ "background-color": "rgb(255, 255, 255)", "position": "relative", "top": "0px", "left": "0", "z-index": '10' })
$("#CapitalTable>table>thead>tr>th").css({ "background-color": "rgb(255, 255, 255)", "position": "relative", "top": "0px" })
$("#CapitalTable>table>tbody>tr>td:nth-of-type(1)").css({ "background-color": "rgb(255, 255, 255)", "position": "relative", "left": "0px", "z-index": '5' })
$("#CapitalTable>table>tbody>tr>td").css({ "min-width": "120px", "border-top": "1px solid #f0f0f0", "padding": '8px', "text-align": 'left', })
表格列是可以拖动的!