API Reference for Datasource Events in JavaScript
onActionStart
This event will be triggered at the beginning of every viewer action, including connection, layout and dashboard rendering, popup opening and closing, refreshing, filtering, exporting, and more.
| Name | Type | Access | Description |
|---|---|---|---|
| eventType | get | Will hold the current event type that triggered the event | |
| source | get | This will contain the data related to the current event as like below. 1. data 2. element |
|
| source.element | object | get | Holds the current event site UI element. If there involves no UI element will be returned as null |
| source.data | object | get | Holds the current event data. |
Example
var dashboard = BoldBI.create({
events: {
onActionStart: function (args) {
if (args.eventType === "dataSourceSaveAction") {
// Write a code block to perform any further actions.
}
}
}
});
dashboard.loadDatasource(); Event Types
| Event Types | Description |
|---|---|
| renderLayout | This event will trigger when the layout of the dashboard started to render. |
| dataSourceSaveAction | This event will trigger when the save icon in clicked. |
| CancelDataSource | This event will trigger when the cancel icon in clicked. |
onActionComplete
This event will be triggered once all viewer actions have been completed.
| Name | Type | Access | Description |
|---|---|---|---|
| eventType | get | Will hold the current event type that triggered the event | |
| source | get | This will contain the data related to the current event as below. 1. element 2. data |
|
| source.element | object | get | Holds the current event site UI element. If there involves no UI element will be returned as null |
| source.data | object | get | Holds the current event data. |
Example
var dashboard = BoldBI.create({
events:{
onActionComplete: function (args) {
if (args.eventType === "dataSourceSaveAction") {
// Write a code block to perform any further actions.
}
}
}
});
dashboard.loadDatasource(); Event Types
| Event Types | Description |
|---|---|
| dataSourceSaveAction | This event will trigger when the save action is completed. |
| SaveConnection | This event will trigger when the new connection is saved. |
datasource
beforeToolbarButtonsRender
This event will be triggered before the datasource toolbar buttons are rendered. You can add or remove buttons in the toolbar with this event.
| Name | Type | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| args.toolbarButtons | array[] | Holds the details of datasource toolbar Buttons.
|
Example for adding new button in datasource toolbar
var dashboard = BoldBI.create({
mode: BoldBI.Mode.DataSource,
events: {
datasource:{
beforeToolbarButtonsRender: function (args) {
// Write a code block to add a new button before the datasource toolbar buttons were rendered.
// args.toolbarButtons.push({
// class:'new-button-class',
// elementId:'new-button-id',
// isActionBtn:true,
// label:'External button'
// });
}
}
}
});
dashboard.loadDatasource(); Example for removing a button from the datasource page
var dashboard = BoldBI.create({
mode: BoldBI.Mode.DataSource,
events: {
datasource:{
beforeToolbarButtonsRender: function (args) {
// Write a code block to remove an existing button before the datasource tool toolbar buttons were rendered.
// args.toolbarButtons.forEach(function (button, index, object) {
// if (button.label == "Cancel") {
// object.splice(index, 1);
// }
// });
}
}
}
});
dashboard.loadDatasource(); beforeToolbarIconsRender
This event will be triggered before the datasource toolbar icons are rendered. You can add or remove icons in the toolbar using this event.
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| args.toolbarIcons | array[] | Holds the details of the datasource toolbar Icons.
|
Example for adding new icon in datasource toolbar
var dashboard = BoldBI.create({
mode: BoldBI.Mode.DataSource,
events: {
datasource:{
beforeToolbarIconsRender: function (args) {
// Write a code block to add an external icon other than Bold BI before the data source toolbar icons are rendered.
// args.toolbarIcons.push({
// class:'fa fa-comments',
// iconType:'custom',
// iconTooltip:'Comment',
// label:'Comment'
// });
}
}
}
});
dashboard.loadDatasource(); Example for removing a icon from the datasource toolbar
var dashboard = BoldBI.create({
mode: BoldBI.Mode.DataSource,
events: {
datasource:{
beforeToolbarIconsRender: function (args) {
// Write a code block to remove an existing button before the datasource toolbar icons were rendered.
// args.toolbarIcons.forEach(function (icon, index, object) {
// if (icon.label == "Run") {
// object.splice(index, 1);
// }
// });
}
}
}
});
dashboard.loadDatasource(); onToolbarItemClick
This event will be triggered when the datasource toolbar icon/button is clicked.
| Name | Type | Access | Description |
|---|---|---|---|
| click | string | get | Holds the name of the icon/button clicked. |
| model | get | Holds the `Datsource's` object. | |
| target | array | get | Contains the parent element of the selected icon/button. |
| type | get | Holds the current event type. | |
| cancel | boolean | set | Holds the cancel value of the current operation. |
Example
var dashboard = BoldBI.create({
mode: BoldBI.Mode.DataSource,
events: {
datasource:{
onToolbarItemClick: function (args) {
// if (args.click == "Copy")
// Write a code block to perform an operation when the Copy icon from designer toolbar is clicked.
// if (args.click == "Preview")
// Write a code block to perform an operation when the Preview button from designer toolbar is clicked.
}
}
}
});
dashboard.loadDatasource(); afterSave
This event will be triggered after the save action of the data source is called.
| Name | Type | Access | Description |
|---|---|---|---|
| eventType | get | Will holds the current event type that triggered the event | |
| model | get | Holds the Data source Viewer's Object. | |
| designer | object | get | Holds the information about the dashboard designer . |
| dataSourceId | string | get | Holds the current data source id. |
| schema | object | get | Holds the current data source schema information such as data base table name, table Id, and so on. | status | boolean | get | Holds the status of the data source save action |
| cancel | boolean | set | Holds the cancel value of the current operation. |
Example
var dashboard = BoldBI.create({
mode: BoldBI.Mode.DataSource,
events:{
datasource:{
afterSave: function (args) {
// Write a code block to perform an operation after the data source save action is called
}
}
}
});
dashboard.loadDatasource();beforeSave
This event will be triggered before the save action of the data source is called.
| Name | Type | Access | Description |
|---|---|---|---|
| eventType | get | Will holds the current event type that triggered the event | |
| model | get | Holds the Data source Viewer's Object. | |
| designer | object | get | Holds the information about the dashboard designer. |
| cancel | boolean | set | Holds the cancel value of the current operation. |
Example
var dashboard = BoldBI.create({
mode: BoldBI.Mode.DataSource,
events:{
datasource:{
beforeSave: function (args) {
// Write a code block to perform an operation before the data source save action is called
}
}
}
});
dashboard.loadDatasource();properties
DatasourceProperties
This section describes the data source properties of the viewer object.
| Name | Type | Access | Description |
|---|---|---|---|
| serverUrl | string | get | Hold the Bold BI Server URL. |
| datasource | string | get | Hold the unique id of the data source. |
| datasourceName | string | get | Hold the data source name. |
| environment | string | get | Hold the embedding environment type. |
| mode | string | get | Hold the mode of the data source. |
Related pages: Datasource | Previous: Methods | Next: Members