Class: QueryDataBlock

QueryDataBlock

QueryDataBlock class holds all data relevant for a single section/query (QueryItem), includin InputItems and OptionItems.

Constructor

new QueryDataBlock(data)

Create QueryDataBlock.
Parameters:
Name Type Description
data Object Defines QueryItem's data (data for a specific form section).
Properties
Name Type Attributes Description
formIndex string <optional>
Current form index used for unique ids.
id string <optional>
Section id.
type string <optional>
Query type, default is "text".
title string <optional>
Query title text.
subtitle string <optional>
Query subtitle text.
label string <optional>
Query label text.
error string <optional>
Query error text.
direction string <optional>
Query direction, either "vertical" or "horizontal".
optionsOrder string <optional>
Query options order, either "before" or "after" the input items.
required boolean <optional>
Sets query filled-in value to be required. Default is false.
css string <optional>
Query specific css string.
before dom | string <optional>
Defines DOM object or a string as text or html to be placed at the beginning of the query.
after dom | string <optional>
Defines DOM object or a string as text or html to be placed at the end of the query.
checkRules boolean | string | RegExp | Array.<boolean> | Array.<string> | Array.<RegExp> <optional>
Defines possible validation queries. If array passed value must match them all.
arrayMatch string <optional>
If set to "and" it will require input value to have a match, if "or" (default) at least one input value will have to have a match.
items Array.<Object> <optional>
Defines input items for this Query.
Properties
Name Type Attributes Description
id string <optional>
Defines input items' ids for this Query.
label string <optional>
Defines input items' labels for this Query.
css string <optional>
Defines input items' css strings for this Query.
error string <optional>
Defines input items' error values - if none set defaults to the general QueryDataBlock error value.
checkRules boolean | string | RegExp | Array.<boolean> | Array.<string> | Array.<RegExp> <optional>
Defines input items for this Query.
arrayMatch string <optional>
If set to "and" it will require input value to have a match, if "or" (default) at least one input value will have to have a match.
options Array.<Object> <optional>
Defines option items for this Query.
Properties
Name Type Attributes Description
id string <optional>
Defines option items' ids for this Query - will be matched with data.items.checkRules.
text string <optional>
Defines option items' text strings for this Query.
css string <optional>
Defines option items' css strings for this Query.
Source:

Members

after

Sets dom which follows the query once rendered.
Source:

after

Get after section dom.
Source:

baseForm

Set baseForm DOM element.
Source:

baseForm

Get this query item's base form DOM object.
Source:

before

Sets dom which preceeds the query once rendered.
Source:

before

Get before section dom.
Source:

css

Get this query item's css.
Source:

direction

Get this query item's direction. Applicable only for draggable queries.
Source:

error

Get this query item's error.
Source:

id

Get this query item's id.
Source:

index

Set index.
Source:

index

Get this query item's index.
Source:

items

Get this query item's items.
Source:

items

Takes an array of items (optionally) and generates an Array of Objects, each Object for one item (InputItemWrapper).
Source:
See:
  • constructor for more information.

label

Get this query item's label.
Source:

options

Takes an array of options (optionally) and generates an Array of Objects, each Object for one option (OptionItem).
Source:
See:
  • constructor for more information.

options

Get this query item's options.
Source:

optionsOrder

Get this query item's options order.
Source:

properInputType

Get proper input type, filtered to a know types only in case unsupported type has been passed.
Source:

required

Find out whether this query fille-in valueis required or if it is optional.
Source:

sectionContainer

Set sectionContainer DOM element.
Source:

sectionContainer

Get this query item's section DOM container.
Source:

subtitle

Get this query item's subtitle.
Source:

title

Get this query item's title.
Source:

type

Get this query item's type.
Source:

Methods

createCustomDomContent(elementopt, customClassopt) → {dom}

Returns a DOM with "dt-custom-form-content" class name, accepts HTML/text strings as well as DOM structures.
Parameters:
Name Type Attributes Description
element dom | string <optional>
A dom object or a string - as text or HTML.
customClass string <optional>
Custom class name to be added to the final element.
Source:
Returns:
- An updated or newly created DOM object.
Type
dom

createUniqueId(idopt)

Creates a unique id for this QuerydataBlock, based on an uniqu InstanceID.
Parameters:
Name Type Attributes Description
id string <optional>
A string to be connected with the unique instance number to create a unique id.
Source:

setProperInputType() → {QueryDataBlock}

Filters all unsupported input types, picks a default if a wrong input type has been passed.
Source:
Returns:
- Returns this QueryDataBlock instance.
Type
QueryDataBlock