我正在使用數據表,我的html表坐在父div的內部。我本來有這個問題,即該表是溢滿父DIV外面是這樣的:如何解決jQuery數據表中溢出Internet Explorer的父級div外?
我發現this answer on stackoverflow添加這個CSS:
#myTable {
table-layout: fixed;
}
#myTable td {
text-overflow: ellipsis;
}
奏效精美來解決該問題。 。在Firefox和Chrome中。因此,對於這些瀏覽器,我現在看到這一點:
不過IE(我使用的IE 11),仍不幸仍顯示溢出問題在上面的第一張照片。對於其他瀏覽器,即使我添加了額外的列,它們仍然受到擠壓,但仍然適合父div(這是我想要的),其中IE將只是保持水平增長
是否有任何關於如何獲得Internet的建議資源管理器,以確保表保持在父分區內,並不溢出它外面?
這裏是我的標題行的HTML,是否可以幫助顯示我是多麼想約束列大小:
<table id="myTable" style="width:100%">
<thead>
<tr>
<th style="width: 22px;">Id</th>
<th style="max-width: 250px" class="nameColumn">Name</th>
<th class="descColumn">Description</th>
<th style="width: 40px;">Status</th>
<th style="width: 38px;">Start</th>
<th style="width: 38px;" class="singleLine">End</th>
<th style="width: 45px;" class="sourceColumn">Source</th>
<th class="ragColumn">RAG</th>
<th style="width: 50px;" class="ownerColumn">Owner</th>
<th class="minorDateColumn singleLine">Prev End</th>
<th class="minorDateColumn singleLine">Orig End</th>
<th style="width: 40px;">Category</th>
<th style="width: 25px;max-width: 25px">Ref</th>
<th style="width: 16px;max-width: 16px">Est</th>
<th class="milestoneCommentsColumn">Comments</th>
<th style="width: 5px;max-width: 5px">D</th>
</tr>
</thead>
這裏是我的DataTable的JavaScript初始化:
var result = $("#myTable")
.DataTable({
"paging": false,
"ordering": true,
"stripeClasses": ['evenColor', 'oddColor']
});
result.order.neutral().draw();
dataTable.draw();
dataTable.columns.adjust().draw();
}
return result;
您的IE11是否在IE11模式下運行?查看開發工具(F12),「仿真」選項卡。 – thirtydot
你能提供任何測試代碼,如Jsfiddle嗎?這將是更容易給你一個答案。 – TyrionGraphiste
我相信我知道這個問題的答案(因爲我以前遇到類似的問題)。但我不能肯定地知道,除非你發佈所有相關的代碼... 8年堆棧溢出,16K代表,225金徽章..和沒有[** MCVE **]的問題(http:// stackoverflow .COM /幫助/ MCVE)?哇!這應該是某種記錄;-) –