隐藏表列的溢出会影响可打开的列隐藏

时间:2013-09-06 11:08:55

标签: jquery html-table footable

我有以下jQuery footable插件表:

<table data-filter="#filter" class="footable" data-page-size="10">
        <thead>
          <tr>
            <th data-class="expand"> Name</th>
            <th data-hide="phone,tablet" data-sort-initial="true"> Author</th>
            <th data-hide="phone,tablet" data-sort-initial="true"> Description</th>
            <th data-hide="phone,tablet" data-sort-initial="true"> Uploaded</th>
            <th data-hide="phone,tablet" data-sort-initial="true"> Expires</th>
            <th data-chide="phone,tablet" data-sort-initial="true" data-type="numeric"> Enrolled</th>
            <th data-hide="phone,tablet" data-sort-initial="true" data-type="numeric"> Points</th>
            <th data-chide="phone,tablet" data-sort-initial="true"> Published</th>
            <th data-chide="phone,tablet" data-sort-initial="true"> Survey</th>                
            <th data-hide="phone,tablet" data-sort-initial="true"> Survey Name</th>
            <th data-chide="phone,tablet" data-sort-initial="true"> Actions</th>
          </tr>
        </thead>
        <tbody> 
        @foreach (var course in Model.CourseList)
        {
          <tr>           
            <td>@course.Name</td>                  
            <td>@course.Author</td>
            <td>@course.Description</td>
            <td>@course.UploadDate.ToShortDateString()</td>
            <td>@course.ExpiryDate.ToShortDateString()</td>                  
            <td>@course.Enrollments.Count</td>  
            <td>@course.ParticipationPoints</td>
            <td>@course.IsPublished</td> 
            <td>@Model.HasSurvey(course.CourseID)</td>  
            <td>@Model.GetSurveyName(course.CourseID)</td>                 
            <td><a href="@Url.Action("ViewCourse", "Admin", new { id = @course.CourseID })" class="view" title="View"> <i class="icon20 icon-zoom-in"></i></a>
            <a href="@Url.Action("EditCourse", "Admin", new { id = @course.CourseID })" class="edit" title="Edit"><i class="icon20 icon-edit"></i></a>
            <a href="@Url.Action("DeleteCourse", "Admin", new { courseID = @course.CourseID })" class="delete" title="Delete"><i class="icon20 icon-remove"></i></a>
            <a href="@Url.Action("PublishCourse", "Admin", new { courseID = @course.CourseID })" class="publish" title="Publish/Unpublish"><i class="icon20 icon-book"></i></a>
            <a href="@Url.Action("BulkTargetCourse", "Admin", new { courseID = @course.CourseID })" class="target" title="Bulk Target"><i class="icon20 icon-screenshot"></i></a></td>
          </tr>
        }                        
        </tbody>
        <tfoot class="footable-pagination">
          <tr>
            <td colspan="8"><ul id="pagination" class="footable-nav" /></td>
          </tr>
        </tfoot>
      </table>

如果我输入文本“abcdefghijklmnopqrstuvwxyzbcdefghijklmnopqrstuvwxyz”而没有任何空格,则不会自动隐藏列,并且表格会跨页面延伸。有没有人看过这个问题,如果有的话,你有没有解决这个问题的方法呢?

此处显示小提琴:http://jsfiddle.net/4RpE8/10/

1 个答案:

答案 0 :(得分:1)

我认为这可以解决您的问题:

.footable td {
    word-break: break-all;
}

这将强制一个长的非破坏字符串在表格单元格中包裹,而不会强制单元格宽度扩展。

请参阅演示:http://jsfiddle.net/audetwebdesign/wStug/

参考:http://www.w3.org/TR/css3-text/#word-break