Module: wcLayoutTable

Methods


function addItem(item [, x] [, y] [, w] [, h]) -> module:wcLayoutTable~tableItem | Boolean

Adds an item into the layout, expanding the grid size if necessary.

Parameters:
Name Type Argument Default Description
item external:jQuery~selector | external:jQuery~Object | external:domNode A DOM element to add.
x Number <optional>
0 The horizontal grid position to place the element.
y Number <optional>
0 The vertical grid position to place the element.
w Number <optional>
1 The number of horizontal cells this item will take within the grid.
h Number <optional>
1 The number of vertical cells this item will take within the grid.
Source:
Returns:
The table data element of the cell that contains the item, or false if there was a problem.
Type
module:wcLayoutTable~tableItem | Boolean

function clear()

Clears the contents of the layout and squashes all rows and columns from the grid.

Source:

function finishBatch()

Ends a batch operation.

Source:
See:

function gridAlternate() -> Boolean

Gets, or Sets whether the table rows alternate in color based on the theme.

Source:
Returns:
- Whether the grid alternates in color.
Type
Boolean

function gridSpacing( [size]) -> Number

Gets, or Sets the spacing between cell borders.

Parameters:
Name Type Argument Description
size Number <optional>
If supplied, sets the pixel size of the spacing between cells.
Source:
Returns:
- The current cell spacing in pixels.
Type
Number

function item(x, y) -> module:wcLayoutTable~tableItem | Boolean

Retrieves the table item at a given grid position, if it exists.Note, if an item spans multiple cells, only the top-left mostcell will actually contain the table item.

Parameters:
Name Type Description
x Number The horizontal grid position.
y Number The vertical grid position.
Source:
Returns:
- The table item, or false if none was found.
Type
module:wcLayoutTable~tableItem | Boolean

function itemStretch(x, y [, sx] [, sy]) -> Boolean

Sets the stretch amount for a given table item. This is more reliable thanassigning width and height style attributes directly on the table item.

Parameters:
Name Type Argument Description
x Number The horizontal grid position.
y Number The vertical grid position.
sx Number | String <optional>
The horizontal stretch for this grid. Use empty string to clear current value. Can be a pixel position, or a string with a 'px' or '%' suffix.
sy Number | String <optional>
The vertical stretch for this grid. Use empty string to clear current value. Can be a pixel position, or a string with a 'px' or '%' suffix.
Version:
  • 3.0.0
Source:
Returns:
- Success or failure. A failure generally means your grid position was a merged grid cell.
Type
Boolean

function showGrid( [enabled]) -> Boolean

Gets, or Sets whether the layout grid cells should draw an outline.

Parameters:
Name Type Argument Description
enabled Boolean <optional>
If supplied, will set the grid cell border visibility.
Source:
Returns:
- The current visibility state of the grid cells.
Type
Boolean

function startBatch()

Begins a batch operation. Basically it refrains from constructingthe layout grid, which causes a reflow, on each item added. Instead,The grid is only generated at the end once wcLayoutTable.finishBatch is called.

Source:

function tableItem_css(style [, value]) -> module:wcLayoutTable~tableItem | String

This function is found in module:wcLayoutTable~tableItem.
A wrapper for jQuery's css function.Note: It is recommended that you use stretch if you intend to alter width or height styles.

Parameters:
Name Type Argument Description
style String The style attribute to alter.
value String <optional>
The value of the attribute. If omitted, the current value of the attribute is returned instead of the tableItem instance.
Version:
  • 3.0.0
Source:
Returns:
- Self, for chaining, unless the value parameter was omitted.
Type
module:wcLayoutTable~tableItem | String

function tableItem_stretch( [sx] [, sy]) -> module:wcLayoutTable~tableItem

This function is found in module:wcLayoutTable~tableItem.
Sets the stretch amount for the current table item. This is more reliable thanassigning width and height style attributes directly on the table item.

Parameters:
Name Type Argument Description
sx Number | String <optional>
The horizontal stretch for this grid. Use empty string to clear current value. Can be a pixel position, or a string with a 'px' or '%' suffix.
sy Number | String <optional>
The vertical stretch for this grid. Use empty string to clear current value. Can be a pixel position, or a string with a 'px' or '%' suffix.
Version:
  • 3.0.0
Source:
Returns:
- Self, for chaining.
Type
module:wcLayoutTable~tableItem

Type Definitions


typedef var tableItem

The table item is an object that represents one cell in the layout table, it containsconvenient methods for cell alteration and supports chaining. Its purpose isto remove the need to alter <tr> and <td> elements of the table directly.

Properties:
Name Type Description
$ jQuery~Object If you truely need the table cell jQuery object, here it is.
css module:wcLayoutTable~tableItem_css Wrapper to alter jQuery's css function.
stretch module:wcLayoutTable~tableItem_stretch More reliable method for setting the table item width/height values.
Version:
  • 3.0.0
Source:
Example
myPanel.addItem(domNode).css('text-align', 'right').css('border', '1px solid black').stretch('100%', '100%');