2010-06-08 29 views
9

如何在IE7,IE8和FF上工作的jqGrid上實現wordwrap,同時也有列調整大小的工作(網格對齊正確)。如何在jqGrid上實現IE7,IE8和FF上的wordwrap

試圖用特定寬度的div(基於初始TH寬度)在每個td上內容包裝內容,但colresize在我插入的div上不起作用。 jqGrid通過計算調整大小的TH和相鄰TH的寬度。

有沒有更好的解決方案,可以避免所有的JavaScript「黑客」?

回答

19

jqGrid Text/Word Wrapping解釋如何做到這一點,使用下面的CSS:

.ui-jqgrid tr.jqgrow td { 
white-space: normal !important; 
height:auto; 
vertical-align:text-top; 
padding-top:2px; 
} 
+1

+1:非常好,清晰的解決方案。我建議只在'ColModel'中使用'title:false'來關閉所有列,以關閉不再需要的工具提示。一個會節省一點記憶。此外,對錶中所有單元格使用其他'vertical-align'作爲'text-top'可能也會很有趣。 – Oleg 2010-06-09 15:41:06

+0

冠軍!很好的答案+小費。 – bcm 2010-06-09 23:07:10

+0

最終刪除了vertical-align:text-top,因爲它導致帶有溢出隱藏內容的列中錨點的下劃線樣式在IE中溢出。 (只有下劃線溢出!) – bcm 2010-06-30 12:21:07

1

使用這個CSS,這必將幫助。

.ui-jqgrid tr.jqgrow td { 
     word-wrap: break-word; /* IE 5.5+ and CSS3 */ 
     white-space: pre-wrap; /* CSS3 */ 
     white-space: normal !important; /* Mozilla, since 1999 */ 
     white-space: -pre-wrap; /* Opera 4-6 */ 
     white-space: -o-pre-wrap; /* Opera 7 */ 
     overflow: hidden; 
     height: auto; 
     vertical-align: middle; 
     padding-top: 3px; 
     padding-bottom: 3px 
    } 
-1

Deall所有,

這可能是如下:

$("#jqxgrid").jqxGrid(

      { 
       source: dataAdapter, 
       width: 1500, 
       autorowheight: true, 
       autoheight: true, 
       columnsresize: true, 
       theme: 'ui-redmond', 
相關問題