List of usage examples for com.google.gwt.dom.client TableElement insertRow
public final native TableRowElement insertRow(int index) ;
From source file:org.xwiki.gwt.wysiwyg.client.plugin.table.util.TableUtils.java
License:Open Source License
/** * Insert a row in the currently edited table. * //from w w w. jav a2 s.com * @param doc the Document to get the selection from. * @param insertBefore indicates the creation position relatively to the currently edited row. * @return the newly created TableRowElement. */ public TableRowElement insertRow(Document doc, boolean insertBefore) { TableRowElement row = getRow(getCaretNode(doc)); TableElement table = getTable(row); int index = row.getRowIndex(); if (!insertBefore) { index++; } TableRowElement newRow = table.insertRow(index); // Populate the row int cellCount = row.getCells().getLength(); for (int i = 0; i < cellCount; i++) { TableCellElement cell = newRow.insertCell(i); cell.setInnerHTML(CELL_DEFAULTHTML); } return newRow; }