-
Notifications
You must be signed in to change notification settings - Fork 0
Cell
The Cell
keyword defines the configuration of the Cell object of a table row. This is the smallest fundamental element of a DSL configuration, and its content is the first value of the result of a query. A Cell can also contain an image or a link.
Its identity fields are:
-
name (required): this attribute accepts a string. It contains the name of the MongoDB database column to which the query is going to make reference. When this is defined, alongside the
table
attribute, thevalue
body property has to be left blank; -
label (optional): this attribute accepts a string. It contains the string that is going to be displayed as a title to the query result;
-
table (required): this attribute accepts a string. It contains the name of the MongoDB database Collection to which the query is going to make reference. When this is defined, alongside the
name
attribute, thevalue
body property has to be left blank; -
type (required): It contains the type of the data contained in the
value
body property or in the result of a query. Possible types are: -
Link: a link to a specific resource
link( label: <text to show> )
-
Image: an image file
image( height: <pixels> width: <pixels> )
-
String: a simple string;
-
Number: a simple number.
-
sortby (optional): this attribute accepts a string. It contains the name of the MongoDB database column that the query will use as a reference to sort the result;
-
order (optional): this attribute accepts a string with value
"asc"
o"desc"
. It's the type of order for the sortby parameter: -
"asc"
means that the order will be ascending (this is also the default value); -
"desc"
means that the order will be descending. -
query (optional): this attribute accepts a JSON object. It contains the parameters and the values on which to execute the query;
-
transformation (optional): this attribute corresponds to the transformation function of an element. The function has to return a value that will overwrite the result of the query;
-
columnLabel (optional): this attribute contains the string that is going to be used as an alternate name to the MongoDB column.
Its body field is:
-
value (required): this parameter contains an arbitrary value to be shown as the result of the query. When this is defined the identity attributes
name
andtable
must be left blank;
The following code shows two examples of a Cell.
Cell with value:
Cell (
type: 'string',
columnLabel: 'Name',
label: 'User',
transformation: function(val) {
return val + " user2";
}
){
value: 'prova'
}
Cell without value:
Cell (
name: 'name',
type: 'string',
table: 'users',
columnLabel: 'Name',
label: 'User',
transformation: function(val) {
return val + " user2";
}
){
}