API
EXAMPLES
INSTALL
SOURCE
API
> LSON
> concept
> function
> object

LAY.Level

LAY.Level represents an object within a LAY application which encapsulates the "level" concept.
It can be instantiated by any of the below LAY methods:

Methods:

attr( attr )

Returns the value of the attribute by the name of attr of the level.

attr: (string) name of the attribute.

data( key, val )

Changes the value of the data of key name key to value val.

key: (string) name of the key of the data requiring change.
val: (any type) value to which it is required to change to.

level( relativePath )

Returns the LAY.Level object relative to the current level.

relativePath: (string) relative path

path()

Returns the (string) path of the level.

parent()

Returns a LAY.Level object representing the current level's parent level.
For the root level the return value is undefined.

remove()

Removes the current level from it's parent level.
Note: the root level cannot be removed. An attempt to do so will throw an error.

Method pertaining to many-type levels

rowAdd( row )

Adds a single row row to the current many-type level.
The new row will subsequently add a new many-derived levels.

row: (rows) row to be added

rowLevelById( id )

Return the many-type level associated with the id value id.

id: (any) value of id associated with the level

rowsMore( list )

Adds an array of rows list to the current many-type level.
The new rows will subsequently add new many-derived levels.

list: (rows) list of new rows to be added

rowsCommit( list )

Changes the rows of the current many-type level to the rows specified in list.

list: (rows) rows to be changed to

rowsUpdate( key, val, query )

Changes the value of the key key of every row matching the LAY.Query query to value val, of the current many-type level.
If query is undefined, the query will be applied to every row.

key: (string) name of the key of the row requiring change.
val: (any type) value to which it is required to change to.
query: (LAY.Query | undefined) query of rows for the rows requiring update. If value is undefined the query will be applied to every row.

rowsDelete( query )

Deletes every row matching the LAY.Query query, of the current many-type level.
If query is undefined, the query will be applied to every row.

query: (LAY.Query | undefined) query of rows for the rows requiring deletion. If value is undefined the query will be applied to every row.

rowsLevels( query )

Returns a list of LAY.Level objects representing the levels derived from the current many-type level, which match every row in the LAY.Query.
If query is undefined, the query will be applied to every row (implying that all derived levels will be returned).

query: (LAY.Query | undefined) query of rows for the rows required. If value is undefined the query will be applied to every row.

queryFilter()

Returns a LAY.Query object containing the rows of many-derived levels of the current many-type level which passes the many filter.

queryRows()

Returns a LAY.Query object containing the rows of many-derived levels of the current many-type level.

Method pertaining to many-derived levels

many()

Returns the many-type level from which the current many-derived level was derived from.

row( key, val )

Changes the value of the row of current many-derived level of key name key to value val.

key: (string) name of the key of the row requiring change.
val: (any type) value to which it is required to change to.

Method pertaining to all levels except many-type levels

children()

Returns a list of LAY.Level objects representing the children levels of the level.

node() Return the HTML Node associated with the current level.

Method pertaining to all levels except many-type levels and many-derived levels

addChildren( lson )

Adds new children to the level.
Note: Ensure that the children within the new LSON do not already exist (i.e they have a unique path)

lson: (object) this argument refers to LSON.

addChild( name, lson )

Adds new child to the level with name name and lson lson.
Note: Ensure that the child (by name) within the new LSON do not already exist (i.e they have a unique path)

name: (string) the name of the child
lson: (object) this argument refers to LSON.