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.
instance.addListener('onInit', (parameters) => {
// instance initialized
myFunc(parameters)
})
Example
onCellMouseDown
onCellMouseDown(event, cell)
Called as soon as a mouse button is pressed.
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.
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.
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.
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.
instance.addListener('onCellClick', (event, cell) => {
// mouse cell click
myFunc(event, cell)
})
Example
onConfigsReady
onConfigsReady(config)
Called as soon as the configuration is loaded.
instance.addListener('onConfigsReady', (config) => {
// config loaded
myFunc(config)
})
Example
onGetInlineTemplate
onGetInlineTemplate(template)
Called as soon as the inline template is loaded.
instance.addListener('onGetInlineTemplate', (template) => {
// inline template loaded
myFunc(template)
})
Example
onLanguageData
onLanguageData(items)
Called as soon as the language data is loaded.
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.
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.
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.
instance.addListener('onVisibleRangeChanged', (start, end) => {
// visible image range changes
doReallyGoodThings(start, end)
})
Example