The goal is to have a custom button on the IG toolbar but doing something other than the regular functions provided by IG, in my example I am trying to achieve two things
- open dialog (via a button)
- execute some custom JS codes
reportsGroupControls = toolbarData.toolbarFind('actions4').controls;
See more about actions4 here.
function(config) {
var $ = apex.jQuery,
toolbarData = $.apex.interactiveGrid.copyDefaultToolbar(),
reportsGroupControls = toolbarData.toolbarFind('actions4').controls;
reportsGroupControls.push({
type: 'BUTTON',
hot: true,
icon: 'fa fa-plus',
iconBeforeLabel: true,
action: 'open_emp_form'
});
reportsGroupControls.push({
type: 'BUTTON',
hot: true,
action: 'say_hello_world'
});
config.toolbarData = toolbarData;
config.initActions = function (actions) {
actions.add([{
name: 'open_emp_form',
label: 'New',
action: $("#newemp").prop("onclick")
},
{
name: 'say_hello_world',
label: 'Hello World',
action: function (event, focusElement) {
alert("Hello World!");
}
// or $("#btn_helloworld").prop("onclick")
}
]);
}
return config;
}