私はかなり複雑な問題に取り組んでおり、問題を短いコード例にまとめようとしました。
jQuery を使用してテーブルに新しいテーブルを作成し、<tr>
colspan を列の合計数に設定すると、テーブル セルの幅 (コードでは設定されていません) が変更されます。これは IE9 で発生しますが、Chrome では発生しません。コードでセル サイズを明示的に指定できることは理解していますが、使用しているソリューションでは実際にはできません。
コードは次のとおりです。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js" type="text/javascript" ></script>
<script type="text/javascript">
var expanded = false;
var $detailsRow;
$(document).ready(function(){
//toggle the details row
$(".selectable-row").click(function(){
if(expanded){
$detailsRow.remove();
expanded = false;
}else{
$detailsRow = $("<tr class=\"child-row\"><td colspan=\"4\">");
$detailsRow.find("td").text("Hellohellohellohellohellohello Hellohellohellohellohellohello Hellohellohellohellohellohello Hellohellohellohellohellohello Hellohellohellohellohellohello Hellohellohellohellohellohello Hellohellohellohellohellohello Hellohellohellohellohellohello Hellohellohellohellohellohello");
$detailsRow.insertAfter($(this));
expanded = true;
}
});
});
</script>
<div style="width:1000px">
<table border="1" style="width:100%">
<tr class="selectable-row">
<td>2012-09-03 11:33</td>
<td>This is the 2nd column</td>
<td>The 3rd column</td>
<td>The last one</td>
</tr>
</table>
</div>
微妙な違いであることに注意してください。2 番目のセルは拡張されており、date-cell はわずかに小さくなっています。
誰かがなぜこれが起こっているのか、そして修正があるかどうかを説明できますか? 何とかセルの内部をdivでラップするかもしれません。私はできる限りそれを試しました。