ColumnStore

A store specialized in handling columns. Used by the Grid to hold its columns and used as a chained store by each SubGrid to hold theirs. Should not be instantiated directly, instead access it through grid.columns or subGrid.columns.

Observing for changes

If you want to listen for changes to the columns in the ColumnStore. For example, if you are interested in when a column has been moved, simply use the on method to listen for the move event:

grid.columns.on({
    move({ records }) {
        // The `records` object contains the moved column records
    }
});

Modifying columns in the ColumnStore

// resize first column
grid.columns.first.width = 200;

// remove city column
grid.columns.get('city').remove();

// add new column
grid.columns.add({text : 'New column'});

// add new column to specific region (SubGrid)
grid.columns.add({text : 'New column', region : 'locked'});

// add new column to 'locked' region (SubGrid)
grid.columns.add({text : 'New column', locked : true});

Storing column state

To store the size and position of columns after a user makes a change, please see GridState.

Configs

57

Common

autoCommitStoreCRUD
dataStore
fieldsStore
groupersStoreGroup
idStore
listenersEvents
sortersStoreSort

Other

autoAddField: Boolean= false

Automatically adds a field definition to the store used by the Grid when adding a new Column displaying a non-existing field.

To enable this behaviour:

const grid = new Grid({
    columns : {
        autoAddField : true,
        data         : [
            // Column definitions here
        ]
    }
}

ColumnStore uses syncDataOnLoad by default (with threshold : 1), to ensure good performance when binding to columns in frameworks.

See syncDataOnLoad for more information.

useSparseIndexStoreSparseIndex

Advanced

stmStoreStm
storageStore
useLocaleSortStoreSort

Chained store

chainedFieldsStoreChained
chainedFilterFnStoreChained
chainFiltersStoreChained
dontRelayToMasterStoreChained
doRelayToMasterStoreChained
ignoreLinkRecordsStoreChained
masterStoreStoreChained
syncOrderStoreChained
syncSortStoreChained

Filtering

filtersStoreFilter
remoteFilterStoreFilter

Misc

Paging

pageParamNameStorePaging
pageSizeStorePaging
remotePagingStorePaging

Records

Remote

filterParamNameStoreFilter

Sorting

remoteSortStoreSort
sortParamNameStoreSort

Tree

treeStore

Properties

64

Common

idStore

Class hierarchy

isColumnStore: Boolean= truereadonly
Identifies an object as an instance of ColumnStore class, or subclass thereof.
isColumnStore: Boolean= truereadonlystatic
Identifies an object as an instance of ColumnStore class, or subclass thereof.
isEventsEvents
isStoreStore
isStoreChainedStoreChained
isStoreChangesStoreChanges
isStoreCRUDStoreCRUD
isStoreFilterStoreFilter
isStoreGroupStoreGroup
isStorePagingStorePaging
isStoreRelationStoreRelation
isStoreSearchStoreSearch
isStoreSortStoreSort
isStoreSparseIndexStoreSparseIndex
isStoreStateStoreState
isStoreStmStoreStm
isStoreSumStoreSum
isStoreSyncStoreSync
isStoreTreeStoreTree

Other

Bottom columns are the ones displayed in the bottom row of a grouped header, or all columns if not using a grouped header. They are the columns that actually display any data.

topColumns: Column[]readonly

Returns the top level columns. If using grouped columns, this is the top level columns. If no grouped columns are being used, this is the leaf columns.

Returns the visible leaf headers which drive the rows' cell content.

currentPageStorePaging
jsonStore
storesstaticStore

Advanced

isChainedStoreChained
StopBranchstaticStoreTree

Filtering

Lifecycle

configBase

Misc

Paging

isPagedStorePaging
lastPageStorePaging
pageSizeStorePaging

Records

autoCommitStoreCRUD
changesStoreCRUD
countStore
dataStore
firstStore
hasChangesStoreCRUD
lastStore
recordsStore

Sort, group & filter

filtersStoreFilter
groupersStoreGroup
isFilteredStoreFilter
isGroupedStoreGroup
isSortedStoreSort
sortersStoreSort

Tree

isTreeStoreTree
leavesStoreTree

Functions

99

CRUD

Removes all columns.

ParameterTypeDescription
silentBoolean

Specify true to suppress events

Returns: Boolean -

true unless the action was prevented, in which case it returns false

addStoreCRUD
applyChangesetStoreChanges
commitStoreCRUD
insertStoreCRUD
loadPageStorePaging
moveStoreCRUD
nextPageStorePaging
previousPageStorePaging
removeStoreCRUD
revertChangesStoreCRUD

Other

Get column by field. To be sure that you are getting exactly the intended column, use Store#getById() with the columns id instead.

ParameterTypeDescription
fieldString

Field name

Returns: Column

Get column by id.

ParameterTypeDescription
idString | Number
Returns: Column

indexOf extended to also accept a columns field, for backward compatibility.

grid.columns.indexOf('name');
ParameterTypeDescription
recordOrIdModel | String
Returns: Number

Call from custom column to register it with ColumnStore. Required to be able to specify type in column config.

ParameterTypeDescription
columnClassfunction

The Column subclass to register.

simpleRendererBoolean

Pass true if its default renderer does not use other fields from the passed record than its configured field. This enables more granular cell updating upon record mutation.

// create and register custom column
class CustomColumn {
 static get type() {
     return 'custom';
 }
}
ColumnStore.registerColumnType(CustomColumn, true);
// now possible to specify in column config
let grid = new Grid({
  columns: [
    { type: 'custom', field: 'id' }
  ]
});
getStorestaticStore
onEvents
relayAllEvents
toJSONStore
triggerEvents
unEvents

Chained store

chainStoreChained
chainTreeStoreChained
fillFromMasterStoreChained

Configuration

applyDefaultsstaticBase

Events

Iteration

everyStore
flatMapStore
forEachStore
mapStore
reduceStore

Lifecycle

destroystaticBase

Misc

initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase

Records

getAtStore

Search

findStoreSearch
findByFieldStoreSearch
findRecordStoreSearch
queryStoreSearch
searchStoreSearch
someStoreSearch

Sort, group & filter

addFilterStoreFilter
addSorterStoreSort
clearFiltersStoreFilter
clearGroupersStoreGroup
clearSortersStoreSort
filterStoreFilter
filterByStoreFilter
getGroupRecordsStoreGroup
getGroupTitlesStoreGroup
groupStoreGroup
isRecordInGroupStoreGroup
removeFilterStoreFilter
removeSorterStoreSort
setGroupersStoreGroup
sortStoreSort

Sum

averageStoreSum
groupSumStoreSum
maxStoreSum
minStoreSum
sumStoreSum

Traverse

getNextStore
getPrevStore

Tree

getChildrenStoreTree
indentStoreTree
loadChildrenStoreTree
outdentStoreTree

Values

Events

36

Fires when a column has been hidden.

// Adding a listener using the "on" method
columnStore.on('columnHide', ({ source, column }) => {

});
ParameterTypeDescription
sourceColumnStore

The store which triggered the event.

columnColumn

The column which status has been changed.

Fires when a column is shown.

// Adding a listener using the "on" method
columnStore.on('columnShow', ({ source, column }) => {

});
ParameterTypeDescription
sourceColumnStore

The store which triggered the event.

columnColumn

The column which status has been changed.

addStoreCRUD
beforeAddStoreCRUD
beforeCommitStoreCRUD
beforeFilterStoreFilter
beforeIndentStoreTree
beforeLoadPageStorePaging
beforeOutdentStoreTree
beforeRemoveStoreCRUD
beforeSortStoreSort
catchAllEvents
changeStore
commitStoreCRUD
destroyEvents
filterStoreFilter
groupStoreGroup
indentStoreTree
loadPageStorePaging
moveStore
outdentStoreTree
refreshStore
removeStoreCRUD
removeAllStoreCRUD
sortStoreSort
updateStore

Event handlers

36

Called when a column has been hidden.

new ColumnStore({
    onColumnHide({ source, column }) {

    }
});
ParameterTypeDescription
sourceColumnStore

The store which triggered the event.

columnColumn

The column which status has been changed.

Called when a column is shown.

new ColumnStore({
    onColumnShow({ source, column }) {

    }
});
ParameterTypeDescription
sourceColumnStore

The store which triggered the event.

columnColumn

The column which status has been changed.

onAddStoreCRUD
onBeforeAddStoreCRUD
onBeforeFilterStoreFilter
onBeforeLoadPageStorePaging
onBeforeSortStoreSort
onCommitStoreCRUD
onDestroyEvents
onFilterStoreFilter
onGroupStoreGroup
onIndentStoreTree
onLoadPageStorePaging
onMoveStore
onOutdentStoreTree
onRemoveStoreCRUD
onRemoveAllStoreCRUD
onSortStoreSort

Typedefs

8