Namespace: dataModelEventHandlers

dataModelEventHandlers

These handlers are called by dataModel.dispatchEvent to perform Hypergrid housekeeping tasks.

(Hypergrid registers itself with the data model by calling dataModel.addListener. Both addListener and dispatchEvent are optional API. If the data model lacks addListener, Hypergrid inserts a bound version of dispatchEvent directly into the data model.)

Coding pattern

If there are no housekeeping tasks to be performed, do not define a handler here.

Otherwise, the typical coding pattern is for our handler to perform the housekeeping tasks, returning undefined to the caller (DispatchDataModelEvent) which then re-emits the event as a Hypergrid event (i.e., as a DOM event to the <canvas> element).

Alternatively, our handler can re-emit the event itself by calling the grid event handler and propagating its boolean return value value to the caller which signals the caller not to re-emit on our behalf. This is useful when tasks need to be performed after the Hypergrid event handler is called (or before and after).

The pattern, in general: ```js exports['fin-hypergrid-data-myevent'] = function(event) { var notCanceled;

PerformHousekeepingTasks();

// optionally re-emit the event as a grid event
var dispatchGridEvent = require('../../lib/dispatchGridEvent.js');
notCanceled = dispatchGridEvent.call(this, event.type, isCancelable, event);

if (!notCanceled) {
    PerformAdditionalHousekeepingTasks()
}

return notCanceled;

} Re-emitting the event is optional; if notCanceled is never defined, the caller will take care of it. If your handler does choose to re-emit the event itself by calling dispatchGridEvent, you should propagate its return value (the result of its internal call to dispatchEvent, which is either false if the event was canceled or true if it was not).

Methods

(static) "fin-hypergrid-data-loaded"(event) → {undefined|boolean}

See the data model API page for event semantics (link below).

Parameters:
Name Type Description
event NormalizedDataModelEvent
See:
Returns:

Result of re-emitted event or undefined if event not re-emitted.

Type
undefined | boolean

(static) "fin-hypergrid-data-postreindex"(event) → {undefined|boolean}

See the data model API page for event semantics (link below).

Parameters:
Name Type Description
event Object
See:
Returns:

Result of re-emitted event or undefined if event not re-emitted.

Type
undefined | boolean

(static) "fin-hypergrid-data-prereindex"(event) → {undefined|boolean}

See the data model API page for event semantics (link below).

Parameters:
Name Type Description
event NormalizedDataModelEvent
See:
Returns:

Result of re-emitted event or undefined if event not re-emitted.

Type
undefined | boolean

(static) "fin-hypergrid-data-shape-changed"(event) → {undefined|boolean}

See the data model API page for event semantics (link below).

Parameters:
Name Type Description
event NormalizedDataModelEvent
See:
Returns:

Result of re-emitted event or undefined if event not re-emitted.

Type
undefined | boolean

(static) "fin-hypergrid-schema-loaded"(event) → {undefined|boolean}

See the data model API page for event semantics (link below).

Parameters:
Name Type Description
event NormalizedDataModelEvent
See:
Returns:

Result of re-emitted event or undefined if event not re-emitted.

Type
undefined | boolean