Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java GWT HTMLTable colaspan功能_Java_Gwt - Fatal编程技术网

Java GWT HTMLTable colaspan功能

Java GWT HTMLTable colaspan功能,java,gwt,Java,Gwt,大家好 我正在使用import com.google.gwt.user.client.ui.HTMLTable的HTMLTable 我将其实例化如下: HTMLTable table = new Grid(rows, col); 行数和列数由用户输入决定。 现在我想对表的特定行使用colspan 实现这一点的一种方法是将css应用于该特定行。但问题是,要跨越的列数由用户输入决定,即每次都可能有所不同。因此,通过使用css,它就像是使它成为静态的 所以我想知道如何在表格的行上进行colspan。

大家好 我正在使用import com.google.gwt.user.client.ui.HTMLTable的HTMLTable 我将其实例化如下:

HTMLTable table = new Grid(rows, col);
行数和列数由用户输入决定。 现在我想对表的特定行使用colspan

实现这一点的一种方法是将css应用于该特定行。但问题是,要跨越的列数由用户输入决定,即每次都可能有所不同。因此,通过使用css,它就像是使它成为静态的

所以我想知道如何在表格的行上进行colspan。 每次跨越的柱数都不一样

提前感谢

试试看

table.getCellFormatter().setAttr(row, col, "colspan", numColsToSpan.toString());

但是setAttr是CellFormatter类的受保护方法,CellFormatter类也是行的内部类Formatter@SanjayJain那么,如果这个答案对你没有帮助,你为什么要接受它呢?