0

这个问题可能是重复的,但我没有得到满足我要求的解决方案。我需要帮助来固定/冻结标题和可滚动 div 元素内的表的几个第一列。数据是动态的,因为 i 列和行可能会增加或减少,具体取决于数据源。目前它有 ~86 行和 ~55 列。列宽是基于数据动态的。

我的 HTML 代码如下所示。

<html>
<body ng-app="myapp" ng-controller="mycontroller">
    <table style="width:100%; height:90%">
        <tr>
            <td width=3%> </td>
            <td>
                <table style="width:100%;">
                    <tr>
                        <td>Page header</td>
                    </tr>
                    <tr><td></td></tr>
                </table>

                <table style="width:100%; height:90%">
                    <tr>
                        <td>
                            <div ng-style="{'width': twidth + 'px', 'heigth':theight + 'px','overflow-x': 'auto','overflow-y': 'auto'}">
                                <table>
                                    <thead ng-repeat="h in dummy| limitTo:1">
                                        <tr>
                                            <th ng-repeat="(key, val) in h">
                                                {{key}}
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-repeat="h in dummy">
                                            <td ng-repeat="(key, val) in h">{{val}}</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</body>
</html>
4

0 回答 0