Skip to main content

Callbacks

The optional JavaScript callback functions enables developers to react on events fired by FSI ImageGrid.

Refer to the appropriate chapter to learn how to implement callbacks.

The following callback functions can be used:

onDestroy

onDestroy()
Called as soon as the viewer is destroyed.

instance.addListener('onDestroy', () => {
// instance is destroyed
doReallyGoodThings()
})
Example

onInit

onInit(parameters)
Called as soon as the viewer is initialized.

parameters
object
parameters as object
instance.addListener('onInit', (parameters) => {
// instance initialized
myFunc(parameters)
})
Example

onCellMouseDown

onCellMouseDown(event, cell)
Called as soon as a mouse button is pressed.

event
event
the event
cell
object
cell object
instance.addListener('onCellMouseDown', (event, cell) => {
// mouse button down
myFunc(event, cell)
})
Example

onCellMouseUp

onCellMouseUp(event, cell)
Called as soon as a mouse button is released.

event
event
the event
cell
object
cell object
instance.addListener('onCellMouseUp', (event, cell) => {
// mouse button up
myFunc(event, cell)
})
Example

onCellMouseOver

onCellMouseOver(event, cell)
Called as soon as the cursor is hovered over a cell.

event
event
the event
cell
object
cell object
instance.addListener('onCellMouseOver', (event, cell) => {
// mouse cell hover
myFunc(event, cell)
})
Example

onCellMouseOut

onCellMouseOut(event, cell)
Called as soon as the hovering cursor is leaving a cell.

event
event
the event
cell
object
cell object
instance.addListener('onCellMouseOut', (event, cell) => {
// mouse cell hover leave
myFunc(event, cell)
})
Example

onCellClick

onCellClick(event, cell)
Called as soon as a cell is clicked.

event
event
the event
cell
object
cell object
instance.addListener('onCellClick', (event, cell) => {
// mouse cell click
myFunc(event, cell)
})
Example

onConfigsReady

onConfigsReady(config)
Called as soon as the configuration is loaded.

config
object
Configuration parameters as object
instance.addListener('onConfigsReady', (config) => {
// config loaded
myFunc(config)
})
Example

onGetInlineTemplate

onGetInlineTemplate(template)
Called as soon as the inline template is loaded.

template
node
the template
instance.addListener('onGetInlineTemplate', (template) => {
// inline template loaded
myFunc(template)
})
Example

onLanguageData

onLanguageData(items)
Called as soon as the language data is loaded.

items
object
the language items
instance.addListener('onLanguageData', (items) => {
// language data loaded
myFunc(items)
})
Example

onReady

onReady()
Called as soon as the instance is ready.

instance.addListener('onReady', () => {
// instance is ready
doReallyGoodThings()
})
Example

onLayoutChanged

onLayoutChanged()
Called as soon as the layout is changed.

instance.addListener('onLayoutChanged', () => {
// layout changed
doReallyGoodThings()
})
Example

onMetaData

onMetaData()
Called as soon as the metadata is loaded.

instance.addListener('onMetaData', () => {
// meta data loaded
doReallyGoodThings()
})
Example

onReplaceTemplateValue

onReplaceTemplateValue(name, value)
Called while the template value is replaced.

name
string
template name
value
string
template value
RETURN
string
Returns the new value.
instance.addListener('onReplaceTemplateValue', (name, value) => {
// template value is currently replaced
myFunc(name, value)
})
Example

onAfterReplaceTemplateValue

onAfterReplaceTemplateValue(content, cell)
Called after the template value is replaced.

content
string
the content you would like to transfer
cell
object
the cell object
instance.addListener('onAfterReplaceTemplateValue', (content, cell) => {
// template value is replaced
myFunc(name, value)
})
Example

onReset

onReset()
Called as soon as the instance is reset.

instance.addListener('onReset', () => {
// instance is reset
doReallyGoodThings()
})
Example

onScroll

onScroll()
Called as soon as a scroll action takes place.

instance.addListener('onScroll', () => {
// instance is scrolled
doReallyGoodThings()
})
Example

onVisibleRangeChanged

onVisibleRangeChanged(start, end)
Called as soon as the visible image range changes.

start
integer
start range
end
integer
end range
instance.addListener('onVisibleRangeChanged', (start, end) => {
// visible image range changes
doReallyGoodThings(start, end)
})
Example