DataTable Class
A DataTable is s collection of ObjectRow and provides information about the structure of logical table
Item Index
Methods
- acceptChanges
- add
- assignField
- autoIncrement
- avoidCollisions
- avoidCollisionsOnField
- cachedMaxSubstring
- calcTemporaryId
- cascadeAssignField
- childRelations
- clear
- clearDefaults
- clearMaxCache
- clone
- collisionFilter
- columnList
- defaults
- denyClear
- detach
- existingRow
- fieldDependencies
- getAutoIncrementColumns
- getChanges
- getMaxExpr
- hasChanges
- importRow
- isOptimized
- key
- keyFilter
- load
- loadArray
- makeChild
- mergeArray
- mergeAsPatch
- mergeAsPost
- mergeAsPut
- minimumTempValue
- newRow
- parentRelations
- postingTable
- realTable
- rejectChanges
- safeAssign
- select
- selectAll
- setMaxExpr
- setOptimize
- skipInsertCopy
- skipSecurity
- staticFilter
- tableForReading
- tableForWriting
- toString
- updateDependencies
- viewTable
Methods
acceptChanges
()
Accept any changes setting all dataRows in the state of 'unchanged'. Deleted rows become detached and are removed from the table
add
-
obj
Adds an object to the table setting the datarow in the state of "added"
Parameters:
-
objObjectplain object
Returns:
DataRow created
assignField
-
r -
field -
value
Assign a value to a field and update all dependencies
autoIncrement
-
fieldName -
[autoIncrementInfo]
Get/Set autoincrement properties of fields
Parameters:
Returns:
avoidCollisions
-
r -
field -
value
check if changing a key field of a row it would collide with come autoincrement field. If it would, recalculates colliding rows/filter in accordance
avoidCollisionsOnField
-
field -
filter
Recalculate a field to avoid collisions on some rows identified by a filter
Parameters:
-
fieldString -
filterSqlFun
cachedMaxSubstring
-
field -
start -
len -
filter
Evaluates the max of an expression eventually using a cached value
Returns:
calcTemporaryId
-
r -
[field]
Augment r[field] in order to avoid collision with another row that needs to take that value if field is not specified, this is applied to all autoincrement field of the table Precondition: r[[field] should be an autoincrement field
cascadeAssignField
-
r -
parentField -
value
assign a value to a field in a row and all descending child rows
childRelations
()
Get all relation where THIS table is the parent and another table is the child
Returns:
DataRelation[]
clear
()
Clears the table detaching all rows.
clearDefaults
()
Clears any stored default value for the table
clearMaxCache
()
Clear evaluated max cache
collisionFilter
-
r -
field -
value -
autoInfo
Gets a filter of colliding rows supposing to change r[field]= value, on a specified column
Parameters:
-
rObjectRow -
fieldString -
valueObject -
autoInfoAutoIncrementColumn
Returns:
columnList
()
get the list of columns or * if there is no column set
Returns:
string
defaults
-
[def]
Get/set the object defaults in a JQuery fashioned style. When def is present, its fields and values are merged into existent defaults.
Parameters:
-
[def]Object optional
Returns:
denyClear
-
[arg]
Get/Set DenyClear. === y avoid to clear table on backend reads
Parameters:
-
[arg]String optional
Returns:
existingRow
-
obj
check if a row is present in the table. If there is a key, it is used for finding the row, otherwise a ==== comparison is made
Parameters:
-
objObject
fieldDependencies
-
field
Gets all autoincrement fields that depends on a given field, i.e. those having field as selector or prefixfield
Parameters:
-
fieldString
Returns:
getAutoIncrementColumns
()
Gets all autoincrement column names of this table
Returns:
string[]
getMaxExpr
-
field -
expr -
filter
gets the max in cache for a field and updates the cache
Returns:
importRow
-
row
import a row preserving it's state, the row should already have a DataRow attached
Parameters:
-
rowObjectinput
Returns:
created
key
-
[k]
Get/Set the primary key in a Jquery fashioned style. If k is given, the key is set, otherwise the existing key is returned
Parameters:
-
[k]String[] optional
Returns:
keyFilter
-
row
Get the filter that compares key fields of a given row
Parameters:
-
rowObject
Returns:
load
-
obj -
[safe=true]
Adds an object to the table setting the datarow in the state of "unchanged"
Parameters:
Returns:
created DataRow
loadArray
-
arr -
safe
Adds an object to the table setting the datarow in the state of 'unchanged'
Parameters:
Returns:
makeChild
-
childRow -
parentTable -
[parentRow]
Make childRow child of parentRow if a relation between the two is found
mergeArray
-
arr -
overwrite
adds an array of objects to collection, as unchanged, if they still are not present. Existence is verified basing on key
Returns:
mergeAsPatch
-
t
merges changes from dataTable t assuming they are unchanged and they are all present in this dataTable. Rows are updated, but only fields actually present in d are modified. Other field are left unchanged. It is assumed that "this" dataTable is unchanged at the beginning
Parameters:
mergeAsPost
-
t
merges changes from dataTable t assuming they are unchanged and they are not present in this dataTable. Rows are all added 'as is' to this, in the state of ADDED It is assumed that "this" dataTable is unchanged at the beginning
Parameters:
mergeAsPut
-
t
merges changes from dataTable t assuming they are unchanged and they can be present in this or not. If a row is not present, it is added. If it is present, it is updated. It is assumed that "this" dataTable is unchanged at the beginning
Parameters:
minimumTempValue
-
field -
[value]
get/set the minimum temp value for a field, assuming 0 if undefined
newRow
-
[obj] -
[parentRow]
creates a DataRow and returns the created object. The created object has the default values merged to the values in the optional parameter obj.
Parameters:
Returns:
parentRelations
()
Get all relation where THIS table is the child and another table is the parent
Returns:
DataRelation[]
postingTable
()
String
public
Returns the table that should be used for writing, using tableForReading as a default for tableForWriting, or this.name if none of them is set
Returns:
realTable
-
[arg]
Get/Set a table name, that represents the real table associated to the table
Parameters:
-
[arg]String optional
Returns:
rejectChanges
()
Reject any changes putting all to 'unchanged' state. Added rows become detached.
safeAssign
-
r -
field -
value
Assign a field assuring it will not cause duplicates on table's autoincrement fields
Returns:
select
-
[filter]
Extract a set of rows matching a filter function - skipping deleted rows
Parameters:
-
[filter]SqlFun optional
Returns:
selectAll
-
filter
Extract a set of rows matching a filter function - including deleted rows
Parameters:
-
filterSqlFun
Returns:
setMaxExpr
-
field -
expr -
filter -
num
Set a value in the max cache
Parameters:
-
fieldString -
exprSqlFun -
filterSqlFun -
numInt
setOptimize
-
value
Mark the table as optimized / not optimized An optimized table has a cache for all autoincrement field
Parameters:
-
valueBoolean
skipInsertCopy
-
[arg]
Get/Set a flag indicating that this table is not subjected to the Insert and Copy function
Parameters:
-
[arg]Boolean optional
Returns:
skipSecurity
-
[arg]
Get/Set a flag indicating that this table is not subjected to security functions in a Jquery fashioned style
Parameters:
-
[arg]Boolean optional
Returns:
staticFilter
-
[filter]
Get/Set a static filter to be used to read data from database in a Jquery fashioned style
Parameters:
-
[filter]SqlFun optional
Returns:
tableForReading
-
[tableName]
Get/Set the name of table to be used to read data from database in a Jquery fashioned style
Parameters:
-
[tableName]String optional
Returns:
tableForWriting
-
[tableName]
Get/Set the name of table to be used to write data from database in a Jquery fashioned style
Parameters:
-
[tableName]String optional
Returns:
updateDependencies
-
row -
field
Re calculate temporaryID affected by a field change. It should be done for every autoincrement field that has that field as a selector or as a prefix field
