dhtmlxScheduler provides the possibility to define a custom set of buttons for the edit and select bars.
By default, the select bar contains 3 buttons ('Details', 'Edit', 'Delete') that are specified by the icons_select configuration option.
scheduler.config.icons_select = [
"icon_details",
"icon_edit",
"icon_delete"
];
Let's consider the select bar shown on the picture below:
To the existing buttons we have added a new one - Location.
Here are our steps:
scheduler.config.icons_select = [
"icon_location",
"icon_details",
"icon_edit",
"icon_delete"
];
Note, any button must start from "icon_"
scheduler.locale.labels.icon_location = "Location";
.dhx_menu_icon.icon_location{
background-image: url('location_icon.png');
}
scheduler._click.buttons.location = function(id){
some_function(id);
};
where scheduler._click.buttons contains the collection of onClick handlers for the buttons of the bar. 'location' is the name of the button set in the icons_edit after the 'icon_' part.
Generally, the edit bar contains 2 buttons ('Save' and 'Cancel') that are specified by the icons_edit configuration option.
scheduler.config.icons_edit = [
"icon_save",
"icon_cancel"
];
Let's consider the edit bar shown on the picture below:
To the Save and Cancel buttons we have added a new one - Info. Here are our steps:
scheduler.config.icons_edit = [
"icon_custom",
"icon_save",
"icon_cancel"
];
scheduler.locale.labels.icon_custom = "Info";
.dhx_menu_icon.icon_custom{
background-image: url('info_icon.png');
}
scheduler._click.buttons.custom = function(id){
some_function;
};
where scheduler._click.buttons contains the collection of onClick handlers for the buttons of the bar. 'custom' is the name of the button set in the icons_edit after the 'icon_' part.
The buttons of the edit and select bars can be changed dynamically depending on some condition.
For example, your events have a custom boolean property important that indicates whether the event is important and can't be deleted by a user. Depending on the value of this property, you'd like to hide/show the 'delete' button in the select bar. To provide such a behavior, use the following technique:
scheduler.attachEvent("onClick", function(id){
var event = scheduler.getEvent(id);
if (event.important)
scheduler.config.icons_select = ["icon_details"];
else
scheduler.config.icons_select = ["icon_details", "icon_delete"];
return true;
});
Back to top