table 内容截断的单元格

table cell with content trucate

我正在使用 JQuery 手机来显示产品数据,像这样的人:

<table data-role="table" id="products-vip" data-column-btn-theme="b" data-column-popup-theme="a" data-mode="columntoggle" class="ui-responsive" data-column-btn-text="See">
        <thead>            
           <tr>
                <-- <th> with table heads -->
            </tr>
        </thead>
        <tbody>

            @foreach(Product in Model)
            {
                <tr>
                    <-- <td> with info of Products-->
               </tr>
            }
        </tbody>
</table>

table 是 "columntoggle"。

我的问题是单元格的内容超出了屏幕的宽度,例如,在 iOS 浏览器中,JQuery Mobile 会截断内容并且不允许移动页面向左或向右查看内容。

我怎么能对 JQuery 移动设备说不截断内容,并使 table 响应,或指示带有自动换行的单元格。

谢谢!...

将 table 放入 div 并允许 div 在 table 超出 div 边界时滚动:

<div class="tableWrapper">
    <table data-role="table" id="products-vip" data-column-btn-theme="b" data-column-popup-theme="a" data-mode="columntoggle" class="ui-responsive table-stroke" data-column-btn-text="See">
            <thead>            
               <tr>
                   <th>Col 1</th>
                   <th>Col 2</th>
                   <th>Col 3</th>
                   <th>Col 4</th>
                </tr>
            </thead>
            <tbody>
                    <tr>
                       <td>Col 1 Row 1 content</td>
                       <td>Col 2 Row 1 content</td>
                       <td>Col 3 Row 1 content</td>
                       <td>Col 4 Row 1 content</td>
                   </tr>
            </tbody>
    </table>
</div>

CSS:

.tableWrapper {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

列内容自动换行,table 保持在 div 内,直到列不能再收缩。此时,table 变得比 div 更宽,并且出现滚动条。

DEMO