logo

PHPEditTable syntax

METHODS (public)

constructor EditTable ($col, $row)

creates instance of a class and sets the dimensions of table.
EditTable(4, 5);

setSheet ($property, $value)

sets the property for all cells in the table.
setSheet('color', 'red');

setRow ($row, $property, $value)

sets the property for row(s) in the table. $row is an integer or array of integers.
setRow(0, 'width', '120px');

setCol ($col, $property, $value)

sets the property for column(s) in the table. $col is an integer or array of integers.
setCol(0, 'color', 'blue');

setCell ($col, $row, $property, $value)

sets the property for cell in the table.
setCell(2, 1, 'value', 'dummy');

setRange ($col1, $row1, $col2, $row2, $property, $value)

sets the property for range in the table.
setRange(1, 1, 2, 2, 'background-color', 'gray');

setValidate ($validateExpression, $validateError = '')

sets the validation expression, invoked when submitting form. if no validation is set, form is not validated before submitting (always is submitted). if $validateExpression is set, the result influences the success of submitting. if no $validateError is set it will not show when validation returns false.
setValidate('@a1+@a2==@c5', 'wrong answer.');

setMacro($name, $array)

sets the macro for future use as new property.
setMacro('header', array('background-color'=>'#bbbbbb', editable' => false, 'text-align' => 'center', 'font-weight'=> 'bolder'));

DrawSheet ()

draws the sheet on the page.
DrawSheet ();

Input2Array ($transpose = false)

converts requests form input table into 2d array.
Input2Array ();

cell/sheet/range/row/column PROPERTIES (public)

value - sets the value of the cell
type - sets the type of the cell (int, float) determines set of allowable input chars - not fully implemented
round - if set, rounds numeric value to set digits
length - not yet implemented
editable - sets if cell can be edited (true/false)
macro - allows to gather more properties as a macro
formula - sets the formula in the cell (does not override value)
  
onplus_color - sets the color of font if a cell value is positive 
onminus_color - sets the color of font if a cell value is negative
onzero_color - sets the color of font if a cell value is zero

validate - sets validation rule for whole sheet

CSS inherited properties
color - sets cell font color
background-color - sets cell background color 
width - sets cell width
border - sets border 
font-family - self explained
font-size - self explained
font-style - self explained
font-variant - self explained
font-weight - self explained
text-align - self explained