2010-08-23 36 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