cpr.data.DataMap

DataMap A data object that has data as key and value.
Hierarchy

Index

Events
Event Description
clear An event that occurs when data information is removed.
load Event occurs when the data structure is reconstructed by the Build method.
update An event that occurs when data is modified.
Properties
Name Type Description
alterColumnLayout String Returns the column structure change criteria when the data structure is reorganized by build.
disposed Boolean Returns whether the control should be removed.
id String Returns the ID of the control.
info String Returns the value of the data map information.
type ControlType Returns the signature string of the Control's unique Type that can distinguish the Control.
uuid String Returns the unique ID of the control.
Methods
Name Return Type Description
addColumn Boolean Add Column
addEventListener Add listeners by EventType to the control.
addEventListenerOnce (e: cpr.events.CEvent)=>Void Add a listener to the control that will run only once per EventType.
bind IBindFactory Bind that property.
build Number Configure DataMap via json data.
clear Remove all data.
copyToDataMap Boolean Copy data from the current datamap to the target datamap.
copyToDataSet Boolean Copies data from the current data map to the target dataset.
deleteColumn Boolean Delete the Column.
dispatchEvent Boolean Forwards specific events.
dispose Removes the objects contained in the control.
getAppInstance AppInstance Returns the app instance to which the control belongs.
getAttr String Returns the value of the property.
getAttrNames String[] Returns an array of all attribute names.
getAttrs {[attrName:string]: String} Returns a json object for all properties.
getBindContext BindContext Returns the bind context.
getBindInfo BindInfo Returns the bind property information for the control.
getBoolean Boolean Returns the data corresponding to the input columnName as a Boolean.
getColumnCount Number Returns the number of columns.
getColumnNames String[] Returns the column name in array format.
getDatas RowConfigInfo Returns the value for all columns as a json object.
getDefaultValue any It returns the default value of the column corresponding to the input columnName.
getHeader Header Returns the Header object through the column name.
getHeaders Header[] Returns the headers in an array.
getNumber Number Returns the data corresponding to the input columnName as a Number.
getOriginalValue Object Returns the original data corresponding to the input columnName.
getString String Returns the data corresponding to the input columnName as a String.
getUserAttrNames String[] Returns all custom attribute names.
getValue Object Returns the data corresponding to the input columnName.
isAvailableBinding Boolean Returns whether the queried property is bindable and the binding has been configured to obtain a valid value.
isBindable Boolean Make sure it is a bindable property.
isExistColumn Boolean Returns whether this column name exists.
parseData Set the data map property, column information, row data information.
putValue Values ​​change events (Before-update, update), but change both source and current values.
removeAllEventListeners Removes all event listeners for the control.
removeAllUserAttr Delete all custom attributes.
removeEventListener Remove Listener for each EventType in the control.
removeEventListeners Remove all EventType listeners from the control.
removeUserAttr Removes user-defined attributes for a specific attribute name.
reset All data is returned to the default.
setAttr Set certain properties.
setDefaultValue Set the default value of the column corresponding to the input columnName.
setValue Correct the data corresponding to the input columnName.
unbind Unbind that property.
userAttr Specifies custom properties.
userData Specifies custom data.
userattr Object Returns a user-defined property.

Constructor

DataMap(id)
Parameters
name type description
id String Returns the ID of the control.

Events

clear
CDataEvent An event that occurs when data information is removed.
Occurrence method: clear, (specific condition) build
When using the build method, an event occurs when DataMap.alterColumnLayout="server".
load
CDataEvent Event occurs when the data structure is reconstructed by the Build method.
It also occurs at the first generation.
update
CDataEvent An event that occurs when data is modified.
Method of occurrence: setValue
 columnName: {string} Column name of the data to be modified 
 beforeValue: {any} the previous value of the cell you want to modify 
 currentValue: {string} current value 

Properties

alterColumnLayout
type String
get
Returns the column structure change criteria when the data structure is reorganized by build.
set
Set the column structure change criteria when the data structure is rebuilt by build.
If you enter an invalid value, it defaults to "client".
disposed
declaring type Control
type Boolean
readonly
Returns whether the control should be removed.
id
declaring type Control
type String
readonly
Returns the ID of the control.
info
type String
get
Returns the value of the data map information.
set
Sets the data map information value.
type
declaring type Control
type ControlType
readonly
Returns the signature string of the Control's unique Type that can distinguish the Control. Please refer to ControlType for available constant values. For UDC controls, each unique type name is returned. Example: udc.MyUDC
uuid
declaring type Control
type String
readonly
Returns the unique ID of the control.

Methods

addColumn(column, value)
Add Column

Header information is added. If there is data, corresponding column data is also added to row data.
Parameters
name type description
column Header The Header object to add
valueoptional Object Set
return Boolean Successful addition of columns
addEventListener(type, listener)
declaring typeControl
Add listeners by EventType to the control.
Add a listener to the control to handle when a specific event occurs.
var button = new cpr.controls.Button("btn01");
button.addEventListener("click", function(e) {
// event code...
});
Parameters
name type description
type String Event type.
listener (e: cpr.events.CEvent)=>Void Event listeners.
addEventListenerOnce(type, listener)
declaring typeControl
Add a listener to the control that will run only once per EventType.
Add a listener to the control to handle when a specific event occurs. The added listener is automatically deleted after running once. Since the object of the added listener is changed, when the listener is deleted It is an object returned after calling addEventListenerOnce and can be deleted.
var button = new cpr.controls.Button("btn01");
button.addEventListenerOnce("click", function(e) {
// event code...
});
Parameters
name type description
type String Event type.
listener (e: cpr.events.CEvent)=>Void Event listeners.
return (e: cpr.events.CEvent)=>Void The modified Listener object.
bind(propertyName)
declaring typeControl
Bind that property.
Parameters
name type description
propertyName #bindable-property_name The attribute name to bind.
return IBindFactory Factory showing bind type.
build(data)
Configure DataMap via json data.
Parameters
name type description
data RowConfigInfo Data.
{[columnName: string]: string | number}
return Number Number of columns added
clear(all)
Remove all data.
Parameters
name type description
alloptional Boolean defaultfalse Whether to remove all information. true: All attributes, column information, and data are removed. false (default): All data is set to blank.
copyToDataMap(targetDataMap)
Copy data from the current datamap to the target datamap.
Only the data of the existing column of the target dataset is copied.
Parameters
name type description
targetDataMap DataMap The target data map into which the copy data will be placed.
return Boolean
copyToDataSet(targetDataSet, targetIndex, after)
Copies data from the current data map to the target dataset.
Only the data in the existing columns of the target dataset is copied.
Data added during copying is INSERTED.
Parameters
name type description
targetDataSet DataCollection The target dataset into which the copy data will reside.
targetIndexoptional Number The row index to which the copy data will be inserted.
afteroptional Boolean Whether to insert after targetIndex.
return Boolean
deleteColumn(columnName)
Delete the Column.
Parameters
name type description
columnName #column Name of the column to be deleted
return Boolean Successful deletion of column
dispatchEvent(e)
declaring typeControl
Forwards specific events.
Parameters
name type description
e CEvent event
return Boolean Successful event delivery.
dispose()
declaring typeControl
Removes the objects contained in the control.
getAppInstance()
declaring typeControl
Returns the app instance to which the control belongs.
return AppInstance The app instance the control belongs to.
getAttr(attrName)
Returns the value of the property.
Parameters
name type description
attrName String Attribute name to import
return String Attribute value of input attribute name
getAttrNames()
Returns an array of all attribute names.
return String[] An array of all attribute names
getAttrs()
Returns a json object for all properties.
return {[attrName:string]: String} : string} A json object of type key: value for all attributes
getBindContext()
declaring typeControl
Returns the bind context.
return BindContext bind context
getBindInfo(propertyName)
declaring typeControl
Returns the bind property information for the control.
Parameters
name type description
propertyName #bindable-property_name The name of the attribute being bound.
return BindInfo BindInfo Properties
getBoolean(columnName)
Returns the data corresponding to the input columnName as a Boolean.
Parameters
name type description
columnName #column The columnName of the column for which to get the value.
return Boolean Boolean type of the data
getColumnCount()
Returns the number of columns.
return Number Number of columns
getColumnNames()
Returns the column name in array format.
return String[] Column name array
getDatas()
Returns the value for all columns as a json object.
return RowConfigInfo Row data of the corresponding row index (key: columnName, value: json object of the corresponding value type)
{[columnName: string]: string | number}
getDefaultValue(columnName)
It returns the default value of the column corresponding to the input columnName.

When entering an incorrect columnName, IllegalargumentalException is throwed.
Parameters
name type description
columnName #column The columnName of the column for which to get the value.
return any This default.
getHeader(columnName)
Returns the Header object through the column name.
Parameters
name type description
columnName String Column name
return Header Header object of column name
getHeaders()
Returns the headers in an array.
return Header[] Header array
getNumber(columnName)
Returns the data corresponding to the input columnName as a Number.
If the value is of type String and forced to Number, NaN is returned.
Parameters
name type description
columnName #column The columnName of the column for which to get the value.
return Number Number of the data
getOriginalValue(columnName)
Returns the original data corresponding to the input columnName.

When entering an incorrect columnName, IllegalargumentalException is throwed.
If there is no data from the input columnName, it returns an empty string ("" ").
If the column data type is expression, it returns the execution execution results.
Parameters
name type description
columnName #column The columnName of the column for which to get the value.
return Object The corresponding source data.
getString(columnName)
Returns the data corresponding to the input columnName as a String.
Parameters
name type description
columnName #column The columnName of the column for which to get the value.
return String String of this data
getUserAttrNames()
declaring typeControl
Returns all custom attribute names.
return String[] An array of all custom attribute names.
getValue(columnName)
Returns the data corresponding to the input columnName.
Parameters
name type description
columnName #column The name of the column from which to retrieve the value.
return Object Data from the input columnName
The return type is determined according to the header datatype.
In the case of decimal type, it is returned to CPR.FOUNDATION.DECIMIMALYPE .
To get the actual value from the decimal object, you must use tonumber () or toString () .
For Expression Type, we return the execution results.
If you have the desired data type, you must create an expression so that the execution results are returned to that type.

If there is a column of the input columnName, it returns the value .
If there is no column of the input columnName, it returns null .
If there is no value in the column of the input columnName, it returns a "(empty string) .
isAvailableBinding(propertyName)
declaring typeControl
Returns whether the queried property is bindable and the binding has been configured to obtain a valid value. Even if no binding is configured and a simple value is specified, it is treated as configured so that a valid value is obtained. For example, binding to a row index that does not exist in the DataSet is an invalid binding.
Parameters
name type description
propertyName #bindable-property_name Property name to check whether binding is valid.
return Boolean
isBindable(propertyName)
declaring typeControl
Make sure it is a bindable property.
Parameters
name type description
propertyName #bindable-property_name Attribute name
return Boolean Confirmation.
isExistColumn(columnName)
Returns whether this column name exists.
Parameters
name type description
columnName String Name of the column to search
return Boolean Whether the column name exists
parseData(datamapInfo)
Set the data map property, column information, row data information.
Parameters
name type description
datamapInfo DataMapConfigInfo Data map information.
{
  AltercolumnLayout: String, // When renewing the data by build, Column Layout Change Reference: "Client" or "Server" or "Merge"
  INFO ?: String, // Data Map Information.
  Columns: {// Column Settings Information.
   Datatype: String, // Data type. ("String" or "number" or "decimal" or "eXPRESSION")
   Name: String, // column name.
   Expression ?: String, // Expression. (When Datatype = "Expression", EXPRESSION Settings)
   DefaultValue ?: String // Default.
  } [],
  Data: {[ColumnName: String]: String | Number} // Data to set up.
}
putValue(columnName, value)
Values ​​change events (Before-update, update), but change both source and current values.
Parameters
name type description
columnName #column The columnName of the column to modify
value Object Value to modify
removeAllEventListeners()
declaring typeControl
Removes all event listeners for the control.
removeAllUserAttr()
declaring typeControl
Delete all custom attributes.
removeEventListener(type, listener)
declaring typeControl
Remove Listener for each EventType in the control.
control.removeEventListener ('click', listener);  
Parameters
name type description
type String Event type.
listener (e: cpr.events.CEvent)=>Void Event listeners.
removeEventListeners(type)
declaring typeControl
Remove all EventType listeners from the control.
control.removeEventListeners ('click');  
Parameters
name type description
type String Event type.
removeUserAttr(key)
declaring typeControl
Removes user-defined attributes for a specific attribute name.
Parameters
name type description
key String The custom attribute name to remove.
reset()
All data is returned to the default.
setAttr(attrName, attrValue)
Set certain properties.
Parameters
name type description
attrName String The attribute name to assign
attrValue String The attribute value to assign
setDefaultValue(columnName, value)
Set the default value of the column corresponding to the input columnName.

When entering an incorrect columnName, IllegalargumentalException is throwed.
Parameters
name type description
columnName #column The columnName of the column for which to get the value.
value any The default value to be set.
setValue(columnName, value)
Correct the data corresponding to the input columnName. If the columnName does not exist, an IllegalArgumentException is thrown.
Parameters
name type description
columnName #column The columnName of the column to modify
value Object Value to modify
unbind(propertyName)
declaring typeControl
Unbind that property.
Parameters
name type description
propertyName #bindable-property_name Attribute name to unbind.
userAttr(key, value)
declaring typeControl
Specifies custom properties.
Parameters
name type description
key String The attribute name to assign
value String The attribute value to specify.
userAttr(key)
declaring typeControl
Returns a user-defined property.
Parameters
name type description
key String The attribute name to get.
return String Custom properties.
userAttr(values)
declaring typeControl
Specify multiple custom properties at once.
Parameters
name type description
values {[key:string]: String} A JSON object containing custom attribute keys/values.
userAttr()
declaring typeControl
Get all custom properties in the form of a map.
return {[key:string]: String}
userData(key, value)
declaring typeControl
Specifies custom data. Unlike user-defined attributes, you can use arbitrary types in addition to strings. When the control is dispose, all custom data is removed.
Parameters
name type description
key String The key of the data to be specified.
value Object Data to specify.
userData(key)
declaring typeControl
get custom data
Parameters
name type description
key String The key of the data to get.
return Object
userData(override)
declaring typeControl
Specifies multiple user-defined data.
Parameters
name type description
override {[key:string]: Object} A JSON object containing user-defined data.
userData()
declaring typeControl
Get all your custom data.
return {[key:string]: Object}
userattr()
declaring typeControl
deprecatedPlease use userAttr.
Returns a user-defined property.
return Object Custom properties.