editor.Table Extends
Class providing high level table editing functions.

Inheritance

Constructor

goog.editor.Table(node)

Parameters

node : Element
Element that is a table or descendant of a table.

Instance Methods

Public Protected Private
createEmptyTd() !Element
Creates an empty TD element and fill it with some empty content so it will show up with borders even in IE pre-7 or if empty-cells is set to 'hide'
Returns: !Element  a new TD element.
code »
insertCellElement(tdrowIndexcolIndex)
Inserts a cell element at the given position. The colIndex is the logical column index, not the position in the dom. This takes into consideration that cells in a given logical row may actually be children of a previous DOM row that have used rowSpan to extend into the row.
Arguments:
td : Element
The new cell element to insert.
rowIndex : number
Row in which to insert the element.
colIndex : number
Column in which to insert the element.
code »
insertColumn(opt_colIndex) !Array.<Element>
Inserts a new column in the table. The column will be created by inserting new TD elements in each row, or extending the colspan of existing TD elements.
Arguments:
opt_colIndex : number=
Index at which to insert the column. If this is omitted the column will be appended to the right side of the table.
Returns: !Array.<Element>  Array of new cell elements that were created to populate the new column.
code »
insertRow(opt_rowIndex) !Element
Inserts a new row in the table. The row will be populated with new cells, and existing rowspanned cells that overlap the new row will be extended.
Arguments:
opt_rowIndex : number=
Index at which to insert the row. If this is omitted the row will be appended to the end of the table.
Returns: !Element  The new row.
code »
mergeCells(startRowIndexstartColIndexendRowIndexendColIndex) boolean
Merges multiple cells into a single cell, and sets the rowSpan and colSpan attributes of the cell to take up the same space as the original cells.
Arguments:
startRowIndex : number
Top coordinate of the cells to merge.
startColIndex : number
Left coordinate of the cells to merge.
endRowIndex : number
Bottom coordinate of the cells to merge.
endColIndex : number
Right coordinate of the cells to merge.
Returns: boolean  Whether or not the merge was possible. If the cells in the supplied coordinates can't be merged this will return false.
code »
refresh()
Walks the dom structure of this object's table element and populates this.rows with goog.editor.TableRow objects. This is done initially to populate the internal data structures, and also after each time the DOM structure is modified. Currently this means that the all existing information is discarded and re-read from the DOM.
code »
removeColumn(colIndex)
Removes a column from the table. This is done by removing cell elements, or shrinking the colspan of elements that span multiple columns.
Arguments:
colIndex : number
Index of the column to delete.
code »
removeRow(rowIndex)
Removes a row from the table, removing the TR element and decrementing the rowspan of any cells in other rows that overlap the row.
Arguments:
rowIndex : number
Index of the row to delete.
code »
splitCell(rowIndexcolIndex) !Array.<Element>
Splits a cell with colspans or rowspans into multiple descrete cells.
Arguments:
rowIndex : number
y coordinate of the cell to split.
colIndex : number
x coordinate of the cell to split.
Returns: !Array.<Element>  Array of new cell elements created by splitting the cell.
code »

Instance Properties

No description.
Code »
element :
No description.
Code »
logger_ : goog.debug.Logger
Logger object for debugging and error messages.
Code »

Static Methods

goog.editor.Table.createDomTable(doccolumnsrowsopt_tableStyle) !Element
Creates a new table element, populated with cells and formatted.
Arguments:
doc : Document
Document in which to create the table element.
columns : number
Number of columns in the table.
rows : number
Number of rows in the table.
opt_tableStyle : Object=
Object containing borderWidth and borderColor properties, used to set the inital style of the table.
Returns: !Element  a table element.
code »
goog.editor.Table.getChildCellElements(tr) !Array.<Element>
Returns all child elements of a TR element that are of type TD or TH.
Arguments:
tr : Element
TR element in which to find children.
Returns: !Array.<Element>  array of child cell elements.
code »

Static Properties

goog.editor.Table.DEFAULT_BORDER_COLOR :
Default color for table borders.
Code »
goog.editor.Table.OPTIMUM_EMPTY_CELL_WIDTH :
Optimum size of empty cells (in pixels), if possible.
Code »
goog.editor.Table.OPTIMUM_MAX_NEW_TABLE_WIDTH :
Maximum width for new tables.
Code »

Package editor

Package Reference