javascript - 列中的数据跑出页面,如何包含/包装它

标签 javascript jquery html css twitter-bootstrap

<分区>


关闭 6 年前

我有 bootstrap 3.x.x。并不是说我有更多的数据。我刚刚看到这些行横跨页面。 这是它的 fiddle

https://jsfiddle.net/m562283y/

因为它是动态的,所以我不会明显地知道何时插入 br 标签,而且这些很糟糕......

TD 列看起来像这样

<td class="ng-binding">00000006,00000005,00000007,00000008,0000000B,0000000D,0000000F,00000010,00000011,00000012,00000013,00000014,00000015,00000016,00000017,00000018,00000019,0000001A,0000001B,0000001C,0000001D,0000001E,0000001F,00000020</td>

获取包装的响应方式是什么?

enter image description here

<div class="ui-view ng-scope"><div class="panel panel-primary ng-scope">
    <!--<div class="panel-heading" style="font-size:large">Baker Beach Device Registry
        </div>-->

    <div class="panel-body">

        <!--<div class="alert alert-info">
            <p>Sort key: {{sortKey}}</p>
            <p>Reverse: {{reverse}}</p>
            <p>Search String : {{search}}</p>
        </div>-->
        <!--<div class="row">-->

            <div class="col-lg-12">
                <form class="form-inline ng-pristine ng-valid">
                <div class="form-group">
                    <label>Search</label>
                    <input type="text" ng-model="search" class="form-control ng-pristine ng-untouched ng-valid ng-empty" placeholder="Search">
                </div>
            </form>
                <div class="panel panel-default">
                    <table class="table table-striped table-hover">
                        <thead>
                            <tr>

                                <th ng-click="sort('DeviceId')">Device ID
                                    <span class="glyphicon sort-icon glyphicon-chevron-down ng-hide" ng-show="sortKey=='DeviceId'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
                                </th>
                                <th ng-click="sort('DeviceStatus')">Device Status
                                    <span class="glyphicon sort-icon glyphicon-chevron-down ng-hide" ng-show="sortKey=='DeviceStatus'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
                                </th>
                                <th ng-click="sort('StagedManifestIdList')">Staged Manifest
                                    <span class="glyphicon sort-icon glyphicon-chevron-down ng-hide" ng-show="sortKey=='StagedManifestIdList'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
                                </th>
                                <th ng-click="sort('ManifestIdList')">Archived Manifests
                                    <span class="glyphicon sort-icon glyphicon-chevron-down ng-hide" ng-show="sortKey=='ManifestIdList'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
                                </th>

                            </tr>
                        </thead>
                        <tbody>

                            <!-- ngRepeat: device in vm.devices|orderBy:sortKey:reverse|filter:search|itemsPerPage:7 --><tr ng-repeat="device in vm.devices|orderBy:sortKey:reverse|filter:search|itemsPerPage:7" class="ng-scope">
                                <!--Add in sref directive-->
                                <td><a ui-sref="deviceDetail({DeviceId: device.DeviceId})" class="ng-binding" href="#/devices/00022BBA000000200001">00022BBA000000200001</a>
                                </td>

                                <!--<td>{{device.DeviceStatus}}</td>-->
                                <td ng-style="set_color(device)" class="ng-binding" style="color: orange;">Unactivated</td>
                                <!--<td ng-style="{'color':(device.DeviceStatus>1?'red':'blue')}">{{device.DeviceStatus | deviceStatus }}</td>-->
                                <td class="ng-binding"></td>
                                <td class="ng-binding">00000002,00000001,00000003,00000004</td>
                                <td>
                                    <a class="btn btn-primary" ui-sref="deviceEdit.info({DeviceId: device.DeviceId})" href="#/devices/edit/00022BBA000000200001/info">
                        Edit
                    </a>
                                </td>
                            </tr><!-- end ngRepeat: device in vm.devices|orderBy:sortKey:reverse|filter:search|itemsPerPage:7 --><tr ng-repeat="device in vm.devices|orderBy:sortKey:reverse|filter:search|itemsPerPage:7" class="ng-scope">
                                <!--Add in sref directive-->
                                <td><a ui-sref="deviceDetail({DeviceId: device.DeviceId})" class="ng-binding" href="#/devices/00022BBA000000220001">00022BBA000000220001</a>
                                </td>

                                <!--<td>{{device.DeviceStatus}}</td>-->
                                <td ng-style="set_color(device)" class="ng-binding" style="color: orange;">Unactivated</td>
                                <!--<td ng-style="{'color':(device.DeviceStatus>1?'red':'blue')}">{{device.DeviceStatus | deviceStatus }}</td>-->
                                <td class="ng-binding"></td>
                                <td class="ng-binding">0000000A,00000009,0000000C,0000000E</td>
                                <td>
                                    <a class="btn btn-primary" ui-sref="deviceEdit.info({DeviceId: device.DeviceId})" href="#/devices/edit/00022BBA000000220001/info">
                        Edit
                    </a>
                                </td>
                            </tr><!-- end ngRepeat: device in vm.devices|orderBy:sortKey:reverse|filter:search|itemsPerPage:7 --><tr ng-repeat="device in vm.devices|orderBy:sortKey:reverse|filter:search|itemsPerPage:7" class="ng-scope">
                                <!--Add in sref directive-->
                                <td><a ui-sref="deviceDetail({DeviceId: device.DeviceId})" class="ng-binding" href="#/devices/00022BBA000000210001">00022BBA000000210001</a>
                                </td>

                                <!--<td>{{device.DeviceStatus}}</td>-->
                                <td ng-style="set_color(device)" class="ng-binding" style="color: green;">Activated</td>
                                <!--<td ng-style="{'color':(device.DeviceStatus>1?'red':'blue')}">{{device.DeviceStatus | deviceStatus }}</td>-->
                                <td class="ng-binding"></td>
                                <td class="ng-binding">00000006,00000005,00000007,00000008,0000000B,0000000D,0000000F,00000010,00000011,00000012,00000013,00000014,00000015,00000016,00000017,00000018,00000019,0000001A,0000001B,0000001C,0000001D,0000001E,0000001F,00000020</td>
                                <td>
                                    <a class="btn btn-primary" ui-sref="deviceEdit.info({DeviceId: device.DeviceId})" href="#/devices/edit/00022BBA000000210001/info">
                        Edit
                    </a>
                                </td>
                            </tr><!-- end ngRepeat: device in vm.devices|orderBy:sortKey:reverse|filter:search|itemsPerPage:7 --><tr ng-repeat="device in vm.devices|orderBy:sortKey:reverse|filter:search|itemsPerPage:7" class="ng-scope">
                                <!--Add in sref directive-->
                                <td><a ui-sref="deviceDetail({DeviceId: device.DeviceId})" class="ng-binding" href="#/devices/00022B9E000000060001">00022B9E000000060001</a>
                                </td>

                                <!--<td>{{device.DeviceStatus}}</td>-->
                                <td ng-style="set_color(device)" class="ng-binding" style="color: blue;">New Device</td>
                                <!--<td ng-style="{'color':(device.DeviceStatus>1?'red':'blue')}">{{device.DeviceStatus | deviceStatus }}</td>-->
                                <td class="ng-binding">00000022,00000023</td>
                                <td class="ng-binding"></td>
                                <td>
                                    <a class="btn btn-primary" ui-sref="deviceEdit.info({DeviceId: device.DeviceId})" href="#/devices/edit/00022B9E000000060001/info">
                        Edit
                    </a>
                                </td>
                            </tr><!-- end ngRepeat: device in vm.devices|orderBy:sortKey:reverse|filter:search|itemsPerPage:7 -->
                        </tbody>
                    </table>
                    <dir-pagination-controls max-size="5" direction-links="true" boundary-links="true" class="ng-isolate-scope"><!-- ngIf: 1 < pages.length --></dir-pagination-controls>
                </div>
            </div>
        <!--</div>-->
    </div>
</div></div>

最佳答案

您的表格布局需要修复。放入以下CSS:

table{
  table-layout:fixed;
}

table td{
  word-wrap: break-word;
}

这是你的 updated fiddle

关于javascript - 列中的数据跑出页面,如何包含/包装它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39754566/

上一篇:javascript - 如何从 Javascript 调用访问伪元素样式?

下一篇:javascript - 如何自动检测特定 Div 的 scrollTop 位置?

相关文章:

javascript - 如何使用 jQuery 从上到下 float div,就像 myspace.com 的新布局一样?

javascript - 使用 JavaScript/HTML/CSS 开发 OSX 应用程序

javascript - 删除在一个下拉列表字段中选择的选项,并且不显示在该行中存在的其他下拉列表中不工作 - jquery

javascript - 如何使用带有包装器的 Javascript/jQuery 动态修改 CSS 类?

javascript - JS 对象文字中的 "This"- 事件回调中的不同含义

javascript - 如何更改开盘和收盘详情/摘要的图片?

javascript - 使用 HTML 4.01 文档类型嵌入内容(iframe)?

javascript - 无法使用 Skydrive API 获取文件夹内容

javascript - jQuery:在特定窗口大小中添加或删除函数

time - 时间标签中的今天时间