Class: ConditionCollection

ConditionCollection

Members

columnTypesObject

Types of operations grouped by column index.

conditionsObject

Conditions collection grouped by operation type and then column index.

orderStackArray

Order of added condition filters.

Methods

addCondition(column, conditionDefinition, operation)

Add condition to the collection.

Parameters:
Name Type Default Description
column Number

Column index.

conditionDefinition Object

Object with keys:

  • command Object, Command object with condition name as key property.
  • args Array, Condition arguments.
operation String &#39conjunction&#39 optional

Type of conditions operation

Fires:
  • ConditionCollection#event:beforeAdd
  • ConditionCollection#event:afterAdd

clean()

Clean all conditions collection and reset order stack.

Fires:
  • ConditionCollection#event:beforeClean
  • ConditionCollection#event:afterClean

clearConditions(column)

Clear conditions at specified column index but without clearing stack order.

Parameters:
Name Type Description
column Number

Column index.

Fires:
  • ConditionCollection#event:beforeClear
  • ConditionCollection#event:afterClear

destroy()

Destroy object.

exportAllConditions(){Array}

Export all previously added conditions.

Returns: {Array}

getConditions(column){Array}

Get all added conditions from the collection at specified column index.

Parameters:
Name Type Description
column Number

Column index.

Returns: {Array} Returns conditions collection as an array.

hasConditions(column, name){Boolean}

Check if at least one condition was added at specified column index. And if second parameter is passed then additionally
check if condition exists under its name.

Parameters:
Name Type Description
column Number

Column index.

name String optional

Condition name.

Returns: {Boolean}

importAllConditions()

Import conditions to the collection.

isEmpty(){Boolean}

Check if condition collection is empty (so no needed to filter data).

Returns: {Boolean}

isMatch(value, column){Boolean}

Check if value is matched to the criteria of conditions chain.

Parameters:
Name Type Description
value Object

Object with value and meta keys.

column Number optional

Column index.

Returns: {Boolean}

isMatchInConditions(conditions, value, operationType){Boolean}

Check if the value is matches the conditions.

Parameters:
Name Type Default Description
conditions Array

List of conditions.

value Object

Object with value and meta keys.

operationType String &#39conjunction&#39 optional

Type of conditions operation

Returns: {Boolean}

removeConditions(column)

Remove conditions at given column index.

Parameters:
Name Type Description
column Number

Column index.

Fires:
  • ConditionCollection#event:beforeRemove
  • ConditionCollection#event:afterRemove