2010-08-23 78 views
1
爲IE瀏覽器

我創建的網格GWT 和設置屬性合併單元格一行...格列跨度不GWT

gridSample.setWidget(0, 0, new HTML("Can you improve this checklist? Please rank and submit your comments below")); 

gridSample.getCellFormatter().getElement(0, 0).setAttribute("colspan", "4"); 

的合併單元格不適合IE瀏覽器...

回答

0

我假設你使用Grid類。該類不適用於靈活的列和行,因此不支持設置colspan。如果你想設置colspan,請使用類FlexTable。它支持colspan。在你的情況下使用時FlexTable它看起來:

gridSanple.getFlexCellFormatter().setColSpan(0, 0, 4); 

但是,請注意FlexTable慢得多然後Grid。所以如果你有一個大桌子,這可能是一個問題。

2

在IE中有bug。當我使用:

flexTable.getCellFormatter().getElement(hNum, 0).setAttribute("colspan", ""+colCount); 

GWT寫屬性名稱爲「合併單元格」以大寫字母S,IE瀏覽器(如果開放的開發工具,在IE中,我可以看到它),但IE8忽略了它,當我修改爲「 colspan「它正確地工作。 但我不知道如何解決它在GWT ... GWT寫它的自我...... 但它確實有效

flexTable.getFlexCellFormatter().setColSpan(hNum, 0, colCount); 
+0

是的,就是這樣,無論是在IE中(IE 11的情況下)還是在GWT中都有一個錯誤。 'getElement(...)。setAttribute(「colspan」,...)'爲我工作,使用GWT 2.6 – Johanna 2015-01-15 15:20:13

2

試試這個:

gridSample.getCellFormatter().getElement(0, 0).setAttribute("colSpan", "4") 

我的意思是使用colSpan而不是colspan