rendering ...

Overview

The Col object defines the single instance of the cols collection property used in the Table Object schema.

Col Instance Types

Two instance types for the Col object are used internally.

  1. The first, the static object definition, refers to the static Javascript definition.

  2. The second, refers to a Javascript Col object which is created as part of the static Table Object migration process. This instance allows the HTML code to directly access methods defined for the Col object.

The migration process copies all of the static properties to the dynamic version. In addition, each Col object is assigned a cid property that represents a unique system wide ID for that 'Col' object.

It is possible to specify sub-schemas. If one is found the static col objects specified in the sub-schema are also migrated.

Definition Syntax

The Col object definition is found in the cols property of the Table Object oTabProp object. That is the cols property is an array of one or more 'Col` object definitions. Each definition has one or more of the following properties. Some properties are interdependent.

Note that the order the columns are in this definition is the order they appear in both the List Controller display and the Edit Controller field display.

The 'Chqs.js' file shows an example of using custHTML to define a custom HTML file to define the Edit Controller fields and layout. This will override the sequence of the fields in the definition.

addDefault:For type 'actions', if false is specified causes the default 'edit' and 'drop' actions to not be inserted. If unspecified, the defualt value for addDefault is true.

col:If a literal value is specified it names a reference to a Table field (the key of a JSON key/value pair).

A non-literal value is assumed to name a locally defined function which makes the value a computed value. The function will be called with the signature func-name(oObj,scope,oCol) where oObj references the Data Object, scope is the current controller scope and oCol references the dynamic Col instance. It should return a string value. If the computation is extensive the returned value should be cached using the AngularJS $hash object for change detection.

The latter format will cause the type property to be set to 'virt' while the former will cause the type to be set to 'field'.

cssid:For type 'panel' and 'cust', causes the HTML element manufactured on behalf of the column to have an 'id' tag of the value specified.

field:Causes the Col getField function to return this value other than the computed value.

hideLabel:Setting this value to false causes the Triangular system to not generate the column name label in the edit panel. This is used primarily to improve the format for the 'panel' type displays.

hint:Causes col.getHint to be invoked when Edit Controller displays the column.

html????:Used to override the automatically manufactured HTML to process a field. This names a standard or custom template that is injected into the HTML page. The ???? value should be substituted with the mode= HTML parameter on the macro statement that is generating the array of columns (They are nested). In most cases the mode is 'Edit' but it can also be 'List' (the default) or 'Cust'.

<macro col='oSubC' objref=oCol.objName mode='Edit' marker=mark-2a></macro>

is an example in 'AppsBase.htm' of how a sub-template is injected.

legend:For type 'panel', causes the HTML element manufactured on behalf of the column to insert this value into the <fieldset> element.

listHint:Causes col.getListHint to be invoked when List Controller displays the column.

many:Setting this property to 'false' causes the Triangular system to ensure the value of a field is unique across all rows of the Table. The default for this is true. This property only has meaning when the type property is 'field'.

mask:Setting this property to a quoted Regular Expression causes the Editor to ensure the field contents matches the mask as part of its validation cycle.
eg. ,mask: '[A-Za-z\\s\.\-]'

meth????:Used to reference a local function that is to be called by a template function. The Triangular system will ensure the method pointer is moved to the current scope. The sample syntax in the template to reference the function is

<span ng-show='isTrue(oSubC.methHasSubcodes(this,$MODOBJ$,nRow))'>

Refer to macro to see how this is parsed.

place:Causes col.getPlace to be invoked when Edit Controller displays the column. The result is inserted into the <input ...> field as a placeholder attrribute.

readonly:Setting this property to 'true' causes the Edit Controller to prevent input into the field. The default for this is false.

Setting this value to a local function name means the function will be called with a signature of fn($scope,oCol) which expects the value of true or false to be returned. The object being edited is located at $scope.oObj.

This property only has meaning when the type property is 'field'. Virtual fields (type == 'virt') automatically have a readonly status if the showEdit:true setting is applied to them.

reqd:Setting this value to false makes an input field optional. Setting this property to true (the default if not specified) causes the Triangular system to ensure the field contains non-white space data during the validation cycle. ie. The field is "required".

Setting this value to a numeric n where n > 0 causes Triangular to ensure the field contains at least n characters.

schema:Used in conjunction with type 'panel' or 'list', this value points at a locally referenced sub-schema that defines properties base and cols. The latter defines an array of columns according to this syntax specification. Refer to 'Deps.js' as an example.

showEdit:Specify a value of true or false. A true setting will cause the field to be shown on the Edit Controller display.

If not specified only Col.type values of 'field' are shown.

For type 'panel' this property points to a routine called when a sub-object is edited. See 'Deps.js'

showList:Specify a value of true or false. A true setting will cause the field to be shown on the List Controller display.

If not specified only Col.type values of 'field' or 'virt' or 'actions' are shown.

title:A literal containing the string to display where the field name is to be shown. Typically this is List Controller heading or field name in the Edit Controller

If not specified Triangular will insert the function name or referenced field name.

type:This property defines the type of column. Many internal routines use this type to alter their processing paths. The possible value are:

'actions' The actions property names an array of Action Objects. Refer there to the meaning of the fields within the actions property. It is used to add 'actions' to the List Controller display.

Typically the showEdit:false accompanies this value. The addDefault:false prevents Triangular from adding the default 'edit' and 'drop' actions.

'field' The col property references a field in the Data Object. If not defined, the type property is set to 'field' when col is a literal.

'list' The editor will show a sub-list of fields using the col referenced field as the array of sub-objects to list. The schema property points at another array of Col definitions that define the sub-objects. Typically showEdit:true and showList:false accompany this type value.

'panel' The editor will show display an internal panel used to edit a sub-object identified in the a sub-list of fields using the col referenced field as the array of sub-objects to list. The schema property points at another array of Col definitions that define the sub-objects.

Typically showEdit:true and showList:false accompany this type value and showEdit names a function called at the initiation of the sub-edit. In addition the properties htmlCSS, cssid and legend are inspected for values.

'property' The named col is a collection of properties such as those used in the User record.

'virt' The col property references a local function that computes the column value. If not defined, the type property is set to 'virt' when col is a function reference.