| Package | km.display |
| Class | public class SimpleTable |
| Inheritance | SimpleTable flash.display.Sprite |
import km.components.*;
import km.display.*;
import km.skins.*;
function fn(cell:SimpleTableCell):void {
cell.content = new LabelButton();
cell.content.label.text = 'Cell ' + cell.col + ',' + cell.row;
ScriptedSkin.applyTo(cell.content);
}
var table:SimpleTable = new SimpleTable();
table.onCellCreate = fn;
table.setSize(300, 160);
table.move(20, 20);
table.colWidths = [.25, .25, .25, .25];
table.rowHeights = [.25, .25, .25, .25];
table.cellPadding = 3;
table.cell(1,0).span(2,1);
table.update();
addChild(table);
| Property | Defined by | ||
|---|---|---|---|
| background : BitmapData Table background image.
| SimpleTable | ||
| bgColor : uint Table background color [ARGB].
| SimpleTable | ||
| borderColor : uint ARGB cell border color [ARGB].
| SimpleTable | ||
| cellPadding : int Cell padding [px]
| SimpleTable | ||
| colCount : int [read-only] Gets the number of columns.
| SimpleTable | ||
| colWidths : Array Gets or sets the array of column widths.
To calculate the width of a column, the following formula is used : colWidths[col] / totalColWidths[] * tableWidth | SimpleTable | ||
| contentSetSize : Boolean = true Boolean value indicating if a setSize function of the cell content object should be called when the table is rendered.
| SimpleTable | ||
| height : Number | SimpleTable | ||
| onCellCreate : Function A function expecting one variable (cell:SimpleTableCell) that can be set that is called when a cell is created.
| SimpleTable | ||
| onCellRender : Function A function expecting one variable (cell:SimpleTableCell) that can be set that is called when a cell is rendered.
| SimpleTable | ||
| rowCount : int [read-only] Gets the number of rows.
| SimpleTable | ||
| rowHeights : Array Gets or sets the array of row heights.
To calculate the height of a row, the following formula is used : rowHeight[row] / totalRowHeights[] * tableHeight | SimpleTable | ||
| width : Number | SimpleTable | ||
| Method | Defined by | ||
|---|---|---|---|
|
SimpleTable(tableWidth:int = 0, tableHeight:int = 0, columns:int = 0, rows:int = 0)
| SimpleTable | ||
|
cell(col:int, row:int):SimpleTableCell
Get a table cell.
| SimpleTable | ||
|
clearCells():void
Clears all table cells.
| SimpleTable | ||
|
move(x:int, y:int):void
Move the table.
| SimpleTable | ||
|
setSize(tableWidth:int, tableHeight:int, columns:int = 0, rows:int = 0):void
Sets the table size.
| SimpleTable | ||
|
update():void
Updates the table.
| SimpleTable | ||
| background | property |
public var background:BitmapDataTable background image.
| bgColor | property |
public var bgColor:uintTable background color [ARGB].
| borderColor | property |
public var borderColor:uintARGB cell border color [ARGB].
| cellPadding | property |
public var cellPadding:intCell padding [px]
| colCount | property |
colCount:int [read-only]Gets the number of columns.
Implementation public function get colCount():int
| colWidths | property |
colWidths:Array [read-write] Gets or sets the array of column widths.
To calculate the width of a column, the following formula is used : colWidths[col] / totalColWidths[] * tableWidth
public function get colWidths():Array
public function set colWidths(value:Array):void
| contentSetSize | property |
public var contentSetSize:Boolean = trueBoolean value indicating if a setSize function of the cell content object should be called when the table is rendered.
| height | property |
height:Number [read-write]Implementation
public function get height():Number
public function set height(value:Number):void
| onCellCreate | property |
public var onCellCreate:FunctionA function expecting one variable (cell:SimpleTableCell) that can be set that is called when a cell is created.
| onCellRender | property |
public var onCellRender:FunctionA function expecting one variable (cell:SimpleTableCell) that can be set that is called when a cell is rendered.
| rowCount | property |
rowCount:int [read-only]Gets the number of rows.
Implementation public function get rowCount():int
| rowHeights | property |
rowHeights:Array [read-write] Gets or sets the array of row heights.
To calculate the height of a row, the following formula is used : rowHeight[row] / totalRowHeights[] * tableHeight
public function get rowHeights():Array
public function set rowHeights(value:Array):void
| width | property |
width:Number [read-write]Implementation
public function get width():Number
public function set width(value:Number):void
| SimpleTable | () | constructor |
public function SimpleTable(tableWidth:int = 0, tableHeight:int = 0, columns:int = 0, rows:int = 0)Parameters
tableWidth:int (default = 0) |
|
tableHeight:int (default = 0) |
|
columns:int (default = 0) |
|
rows:int (default = 0) |
| cell | () | method |
public function cell(col:int, row:int):SimpleTableCellGet a table cell.
Parameterscol:int |
|
row:int |
SimpleTableCell |
| clearCells | () | method |
public function clearCells():voidClears all table cells.
| move | () | method |
public function move(x:int, y:int):voidMove the table.
Parametersx:int |
|
y:int |
| setSize | () | method |
public function setSize(tableWidth:int, tableHeight:int, columns:int = 0, rows:int = 0):voidSets the table size.
ParameterstableWidth:int |
|
tableHeight:int |
|
columns:int (default = 0) |
|
rows:int (default = 0) |
| update | () | method |
public function update():voidUpdates the table.