ColumnDef

(esrith/amos/core/ColumnDef)

ColumnDef is a class to define column properties. It can set type of column and set hidden some column when using screen sizes of desktop, tablet or phone.

Description
new ColumnDef()

Create a new ColumnDef object.

Description
TYPE_AUTO_NUMBER

Type of column is autoNumber.

TYPE_CHECKBOX

Type of column is checkbox.

TYPE_DATE

Type of column is date.

TYPE_DOMNODE

Type of column is domnode.

TYPE_IMAGEBUTTON

Type of column is imageButton.

TYPE_MATH

Type of column is math.

TYPE_NUMBER

Type of column is number.

TYPE_RADIOBUTTON

Type of column is radiobutton.

TYPE_RESPONSIVE

Type of column is responsive.

TYPE_TEXT

Type of column is text.

TYPE_ZOOM

Type of column is zoom.

Type Description
align String

Specifies the alignment of value.

calculateType String

Type of calculate. If 'columnType' is TYPE_MATH must require calculateType.

child Object

Contain HTML fragment for _TableBase class

columnClass String

css classname for tag td.

columns ColumnDef[]

Column that display in a table.(Array of columnDef.)

columnsMerge String

Merge columns for text total of the table.

columnType String

Type of column. (can use constant)

dateFormat String

Format for data. If 'columnType' is TYPE_DATE must be require dateFormat.

editOption Object

Open or close the edit. Object contains 3 values

enabledCheckAll Boolean

If true, check all checkbox is shown in table header.

fieldName String

Field name where data is stored. This may be from a JSON file or a stored procedure response.

format String

Format for number. If 'columnType' is TYPE_NUMBER or TYPE_AUTO_NUMBER must be require format.

header String

Text for header of the table.

hiddenDesktop Boolean

If true, the column is hidden if desktop screen size is used.

hiddenPhone Boolean

If true, the column is hidden if phone screen size is used.

hiddenTablet Boolean

If true, the column is hidden if tablet screen size is used.

image Object

If 'columnType' is TYPE_IMAGEBUTTON must be require image. This Object contains 2 values.

lookupData Dojo/store/Memory

Property that store data of a column.

lookupDisplayField String

Use in conjunction with lookupData property to control which singular field in the lookupData is selected from.

sortable Boolean

If true, sort button is present for sorting table.

textTotal String

Text for total of the table.

valign String

Specifies the vertical alignment of value.

width String | Number

Width of column.

Return type Description
_preparingColumn(columns) None
Constructors Detail
new ColumnDef()

Create a new ColumnDef object.

constants Detail
<String>
TYPE_AUTO_NUMBER

Type of column is autoNumber.

<String>
TYPE_CHECKBOX

Type of column is checkbox.

<String>
TYPE_DATE

Type of column is date.

<String>
TYPE_DOMNODE

Type of column is domnode.

<String>
TYPE_IMAGEBUTTON

Type of column is imageButton.

<String>
TYPE_MATH

Type of column is math.

<String>
TYPE_NUMBER

Type of column is number.

<String>
TYPE_RADIOBUTTON

Type of column is radiobutton.

<String>
TYPE_RESPONSIVE

Type of column is responsive.

<String>
TYPE_TEXT

Type of column is text.

<String>
TYPE_ZOOM

Type of column is zoom.

Properties Detail
<String>
align

Specifies the alignment of value.

Default value: left

<String>
calculateType

Type of calculate. If 'columnType' is TYPE_MATH must require calculateType.

Default value: sum

<Object>
child

Contain HTML fragment for _TableBase class

<String>
columnClass

css classname for tag td.

<ColumnDef[]>
columns

Column that display in a table.(Array of columnDef.)

<String>
columnsMerge

Merge columns for text total of the table.

Default value: []

<String>
columnType

Type of column. (can use constant)

<String>
dateFormat

Format for data. If 'columnType' is TYPE_DATE must be require dateFormat.

Default value: d MMMM yyyy

<Object>
editOption

Open or close the edit. Object contains 3 values

Sub-properties:

  • <Boolean> editable=false Optional

    If true, open the editor.

  • <String> controlType Required

    Control namespace.

  • <Object> control Optional

    Constructor parameter.

<Boolean>
enabledCheckAll

If true, check all checkbox is shown in table header.

Default value: false

<String>
fieldName

Field name where data is stored. This may be from a JSON file or a stored procedure response.

<String>
format

Format for number. If 'columnType' is TYPE_NUMBER or TYPE_AUTO_NUMBER must be require format.

Default value: #,###.###

<String>
header

Text for header of the table.

<Boolean>
hiddenDesktop

If true, the column is hidden if desktop screen size is used.

Default value: false

<Boolean>
hiddenPhone

If true, the column is hidden if phone screen size is used.

Default value: false

<Boolean>
hiddenTablet

If true, the column is hidden if tablet screen size is used.

Default value: false

<Object>
image

If 'columnType' is TYPE_IMAGEBUTTON must be require image. This Object contains 2 values.

Sub-properties:

  • <String> normal Required

    Path to normal image.

  • <String> over Required

    Path to over image.

<Dojo/store/Memory>
lookupData

Property that store data of a column.

Sample:
     var sampleData =  [
                 {id:1, name:"Blue", codename:"Blu01"},
                 {id:2, name:"Red", codename:"Red01"}
             ];
             var dataStore = new Memory({data: sampleData});
             var colData = new ColumnDef({lookupData: dataStore});
<String>
lookupDisplayField

Use in conjunction with lookupData property to control which singular field in the lookupData is selected from.

Sample:
     var colData = new ColumnDef({
                 lookupData: dataStore,
                 fieldName: "id",
                 lookupDisplayField: "codename",
             });
<Boolean>
sortable

If true, sort button is present for sorting table.

Default value: false

<String>
textTotal

Text for total of the table.

Default value: รวม

<String>
valign

Specifies the vertical alignment of value.

Default value: top

<String | Number>
width

Width of column.

Default value: auto

Methods Detail
_preparingColumn
(
  • columns
)
Parameters