# ColOps | tablefilter v0.4.16 API Document

    import ColOps from 'tablefilter/src/extensions/colOps/colOps.js'

public class | source

# ColOps

#### Extends:

Feature → ColOps

Column calculations extension

## Constructor Summary

Public Constructor
public | constructor (tf: TableFilter, opts: Object) Creates an instance of ColOps |

## Member Summary

Public Members
public | initialized : boolean |
public | onAfterOperation : Function Callback fired after columns operations are completed |
public | onBeforeOperation : Function Callback fired before columns operations start |
public | opts : Object Configuration options |

## Method Summary

Public Methods

public

calc ()

Calculates columns' values Configuration options are stored in 'opts' property

- 'id' contains ids of elements showing result (array)
- 'col' contains the columns' indexes (array)
- 'operation' contains operation type (array, values: 'sum', 'mean', 'min', 'max', 'median', 'q1', 'q3')
- 'write_method' array defines which method to use for displaying the result (innerHTML, setValue, createTextNode) - default: 'innerHTML'
- 'tot_row_index' defines in which row results are displayed (integers array)

public | destroy () Remove extension |
public | init () Initializes ColOps instance |

## Inherited Summary

From class Feature
public | config : Object TableFilter configuration |
public | emitter : Emitter TableFilter emitter instance |
public | enabled : Boolean TableFilter feature setting |
public | feature : String Feature name |
public | initialized : Boolean Field indicating whether Feature is initialized |
public | tf : TableFilter TableFilter instance |
public | destroy () Destroy the feature |
public | disable () Disable the feature |
public | enable () Enable the feature |
public | init () Initialize the feature |
public | isEnabled (): Boolean Indicate whether the feature is enabled or not |
public | reset () Reset the feature after being disabled |

## Public Constructors

### public constructor(tf: TableFilter, opts: Object) source

Creates an instance of ColOps

#### Override:

Feature#constructor

#### Params:

Name | Type | Attribute | Description
tf | TableFilter |  | TableFilter instance
opts | Object |  | Configuration object

## Public Members

### public initialized: boolean source

#### Override:

Feature#initialized

### public onAfterOperation: Function source

Callback fired after columns operations are completed

### public onBeforeOperation: Function source

Callback fired before columns operations start

### public opts: Object source

Configuration options

## Public Methods

### public calc() source

Calculates columns' values Configuration options are stored in 'opts' property

- 'id' contains ids of elements showing result (array)
- 'col' contains the columns' indexes (array)
- 'operation' contains operation type (array, values: 'sum', 'mean', 'min', 'max', 'median', 'q1', 'q3')
- 'write_method' array defines which method to use for displaying the result (innerHTML, setValue, createTextNode) - default: 'innerHTML'

- 'tot_row_index' defines in which row results are displayed (integers array)

- changes made by Nuovella: (1) optimized the routine (now it will only process each column once), (2) added calculations for the median, lower and upper quartile.

### public destroy() source

Remove extension

#### Override:

Feature#destroy

### public init() source

Initializes ColOps instance

#### Override:

Feature#init