cpr.data.DataMap
DataMap
A data object that has data as key and value.
Index
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. |
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. |
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
name |
type |
description |
id
|
String |
Returns the ID of the control. |
Events
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".
CDataEvent Event occurs when the data structure is reconstructed by the Build method.
It also occurs at the first generation.
CDataEvent An event that occurs when data is modified.
Method of occurrence: setValue
columnName: {string} Column name of the data to be modified pre>
beforeValue: {any} the previous value of the cell you want to modify pre>
currentValue: {string} current value pre>
Properties
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".
|
declaring type
|
Control |
type
|
Boolean |
readonly
|
Returns whether the control should be removed.
|
declaring type
|
Control |
type
|
String |
readonly
|
Returns the ID of the control.
|
type
|
String |
get
|
Returns the value of the data map information.
|
set
|
Sets the data map information value.
|
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
|
declaring type
|
Control |
type
|
String |
readonly
|
Returns the unique ID of the control.
|
Methods
Add Column
Header information is added. If there is data, corresponding column data is also added to row data.
name |
type |
description |
column
|
Header |
The Header object to add |
valueoptional
|
Object |
Set |
return
|
Boolean |
Successful addition of columns |
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...
});
name |
type |
description |
type
|
String |
Event type. |
listener
|
(e: cpr.events.CEvent)=>Void |
Event listeners. |
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...
});
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 that property.
name |
type |
description |
propertyName
|
#bindable-property_name |
The attribute name to bind. |
Configure DataMap via json data.
name |
type |
description |
data
|
RowConfigInfo |
Data.
{[columnName: string]: string | number} |
return
|
Number |
Number of columns added |
Remove all data.
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. |
Copy data from the current datamap to the target datamap.
Only the data of the existing column of the target dataset is copied.
name |
type |
description |
targetDataMap
|
DataMap |
The target data map into which the copy data will be placed. |
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.
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. |
Delete the Column.
name |
type |
description |
columnName
|
#column |
Name of the column to be deleted |
return
|
Boolean |
Successful deletion of column |
Forwards specific events.
name |
type |
description |
e
|
CEvent |
event |
return
|
Boolean |
Successful event delivery. |
Removes the objects contained in the control.
Returns the app instance to which the control belongs.
return
|
AppInstance |
The app instance the control belongs to. |
Returns the value of the property.
name |
type |
description |
attrName
|
String |
Attribute name to import |
return
|
String |
Attribute value of input attribute name |
Returns an array of all attribute names.
return
|
String[] |
An array of all attribute names |
Returns a json object for all properties.
return
|
{[attrName:string]: String} |
: string} A json object of type key: value for all attributes |
Returns the bind context.
Returns the bind property information for the control.
name |
type |
description |
propertyName
|
#bindable-property_name |
The name of the attribute being bound. |
Returns the data corresponding to the input columnName as a Boolean.
name |
type |
description |
columnName
|
#column |
The columnName of the column for which to get the value. |
return
|
Boolean |
Boolean type of the data |
Returns the number of columns.
return
|
Number |
Number of columns |
Returns the column name in array format.
return
|
String[] |
Column name array |
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} |
It returns the default value of the column corresponding to the input columnName.
When entering an incorrect columnName, IllegalargumentalException is throwed.
name |
type |
description |
columnName
|
#column |
The columnName of the column for which to get the value. |
Returns the Header object through the column name.
name |
type |
description |
columnName
|
String |
Column name |
return
|
Header |
Header object of column name |
Returns the headers in an array.
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.
name |
type |
description |
columnName
|
#column |
The columnName of the column for which to get the value. |
return
|
Number |
Number of the data |
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.
name |
type |
description |
columnName
|
#column |
The columnName of the column for which to get the value. |
return
|
Object |
The corresponding source data. |
Returns the data corresponding to the input columnName as a String.
name |
type |
description |
columnName
|
#column |
The columnName of the column for which to get the value. |
return
|
String |
String of this data |
Returns all custom attribute names.
return
|
String[] |
An array of all custom attribute names. |
Returns the data corresponding to the input columnName.
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) . |
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.
name |
type |
description |
propertyName
|
#bindable-property_name |
Property name to check whether binding is valid. |
Make sure it is a bindable property.
name |
type |
description |
propertyName
|
#bindable-property_name |
Attribute name |
return
|
Boolean |
Confirmation. |
Returns whether this column name exists.
name |
type |
description |
columnName
|
String |
Name of the column to search |
return
|
Boolean |
Whether the column name exists |
Set the data map property, column information, row data information.
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.
} |
Values change events (Before-update, update), but change both source and current values.
name |
type |
description |
columnName
|
#column |
The columnName of the column to modify |
value
|
Object |
Value to modify |
Removes all event listeners for the control.
Delete all custom attributes.
Remove Listener for each EventType in the control.
control.removeEventListener ('click', listener); code> pre>
name |
type |
description |
type
|
String |
Event type. |
listener
|
(e: cpr.events.CEvent)=>Void |
Event listeners. |
Remove all EventType listeners from the control.
control.removeEventListeners ('click'); code> pre>
name |
type |
description |
type
|
String |
Event type. |
Removes user-defined attributes for a specific attribute name.
name |
type |
description |
key
|
String |
The custom attribute name to remove. |
All data is returned to the default.
Set certain properties.
name |
type |
description |
attrName
|
String |
The attribute name to assign |
attrValue
|
String |
The attribute value to assign |
Set the default value of the column corresponding to the input columnName.
When entering an incorrect columnName, IllegalargumentalException is throwed.
name |
type |
description |
columnName
|
#column |
The columnName of the column for which to get the value. |
value
|
any |
The default value to be set. |
Correct the data corresponding to the input columnName.
If the columnName does not exist, an IllegalArgumentException is thrown.
name |
type |
description |
columnName
|
#column |
The columnName of the column to modify |
value
|
Object |
Value to modify |
Unbind that property.
name |
type |
description |
propertyName
|
#bindable-property_name |
Attribute name to unbind. |
Specifies custom properties.
name |
type |
description |
key
|
String |
The attribute name to assign |
value
|
String |
The attribute value to specify. |
Returns a user-defined property.
name |
type |
description |
key
|
String |
The attribute name to get. |
return
|
String |
Custom properties. |
Specify multiple custom properties at once.
name |
type |
description |
values
|
{[key:string]: String} |
A JSON object containing custom attribute keys/values. |
Get all custom properties in the form of a map.
return
|
{[key:string]: String} |
|
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.
name |
type |
description |
key
|
String |
The key of the data to be specified. |
value
|
Object |
Data to specify. |
get custom data
name |
type |
description |
key
|
String |
The key of the data to get. |
Specifies multiple user-defined data.
name |
type |
description |
override
|
{[key:string]: Object} |
A JSON object containing user-defined data. |
Get all your custom data.
return
|
{[key:string]: Object} |
|
Returns a user-defined property.
return
|
Object |
Custom properties. |