table单元格内容过多换行显示

<table class="am-table am-table-striped am-table-hover table-main am-table-compact " style="table-layout: fixed;">

              <thead>

              <tr>

              <th class="table-check"><input type="checkbox" id="checkall"/></th> 

                <th class="table-author am-show-sm-only">节目名称</th>

                 <th class="table-author am-show-sm-only"style="width:120px;">所属电视台</th>

                <th class="table-author am-hide-sm-only" style="width:50px;">版本</th>

                <th class="table-author am-hide-sm-only">开始时间</th>

                <th class="table-author am-hide-sm-only">结束时间</th>

                <th class="table-date am-hide-sm-only">获取时间</th>

                <th class="table-set" style="width:140px;">操作</th>

              </tr>

              </thead>

              <tbody>

              [#if list][#list list.items as t]

              <tr>

<td><input type="checkbox" class="checkone"/><input type="hidden" value="${t._id}"></td> 

              <td style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" class="logcontent" >${t.program}</td>

              <td >${t.channelName}</td>

               <td >${t.__v}</td>

      <td style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" class="logcontent">${t.beginTime?string("yyyy年MM月dd日HH时mm分ss秒")}</td>

            <td style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" class="logcontent">${t.endTime?string("yyyy年MM月dd日HH时mm分ss秒")}</td>

               <td style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" class="logcontent">${t.addTime?string("yyyy年MM月dd日HH时mm分ss秒")}</td>

                <td>

                  <div class="am-btn-toolbar">

                    <div class="am-btn-group am-btn-group-xs">

                      <button class="am-btn am-btn-default am-btn-xs am-text-secondary"  onclick="location='/TVPrograms/addOne.do?_id=${t._id}&userName=${datamanager.username}&forwardUrl=${forwardUrl}'" ><span class="am-icon-pencil-square-o"></span> 编辑</button>

                      <button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"   onclick="check('${t._id}','${datamanager.username}')"><span class="am-icon-trash-o"></span> 删除</button>

                    </div>

                  </div>

                </td>

              </tr>

              [/#list]

              [/#if]

              </tbody>

            </table>

js代码:

//logcontent内容过长

$(".logcontent").each(function(){

$(this).click(function(){

var a = $(this).css("white-space");

if(a=="nowrap"){

$(this).css("white-space","normal");

}else{

$(this).css("white-space","nowrap");

}

})

})

 

style="table-layout: fixed;":设置表格大小固定 (列宽由表格宽度和列宽度设定)。

style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;"

   overflow溢出内容会被修剪,并且其余内容是不可见的。

   white-space:规定段落中的文本不进行换行

   text-overflow:显示省略符号来代表被修剪的文本。

posted @ 2017-05-01 21:56  啄木鸟伍迪  阅读(6621)  评论(0编辑  收藏  举报
//火箭 GenerateContentList();