ViewPresetCombo
A combo for selecting ViewPreset for Scheduler and Gantt. Lets the user select between specified presets available.
//<code-header>
fiddle.title = 'View preset combo';
//</code-header>
new Scheduler({
appendTo : targetElement,
autoHeight : true,
resources : [
{ id : 1, name : 'Bernard' },
{ id : 2, name : 'Bianca' }
],
events : [
{ id : 1, resourceId : 1, name : 'Interview', location : 'Office', startDate : '2018-05-07', endDate : '2018-05-10' },
{ id : 2, resourceId : 2, name : 'Meeting', location : 'Client`s office', startDate : '2018-05-10', endDate : '2018-05-12' }
],
tbar : [
{ type : 'viewpresetcombo' }
],
startDate : new Date(2018, 4, 6),
endDate : new Date(2018, 4, 13),
columns : [
{ field : 'name', text : 'Name', width : 100 }
]
});startDate will be calculated to
the beginning of the mainUnit of the
viewportCenterDate. If the ViewPreset has a
start configured, this will be added to the calculation. The
endDate will then be calculated by adding the ViewPreset's
defaultSpan to the startDate. Set useFixedDuration to
false to prevent this behaviour.Add it to the component's toolbar to connect it automatically:
new Scheduler({
tbar : {
viewPresetCombo: {
type: 'viewpresetcombo',
width: '7em'
}
}
});
Or specify which Scheduler, SchedulerPro or Gantt component instance it should connect to the client config:
const scheduler = new Scheduler({ ... });
const viewPresetCombo = new ViewPresetCombo({
appendTo : 'someElementClassName',
client : scheduler
});
By default, the following presets are shown in the combo:
Changing selectable presets
To change the default selectable presets specify an array of preset ids. The presets specified must be available to the client.
viewPresetCombo: {
presets: ['weekAndDay', 'dayAndMonth', 'myCustomPreset']
}
NOTE: The selectable presets will be arranged in the order provided in the presets config.
Configs
148
Configs
148Other
If not added to a toolbar, provide a Scheduler, SchedulerPro or Gantt component instance to which the ViewPresetCombo should be connected.
An array containing string ViewPreset ids available for selection. The specified presets must be available for the client (Scheduler, SchedulerPro or Gantt) for it to work properly. The selectable presets will be arranged in the order provided here.
As default, a preset change by the ViewPresetCombo will result in that the startDate will be calculated to
the beginning of the mainUnit of the
viewportCenterDate. If the ViewPreset has a
start configured, this will be added to the calculation. The
endDate will then be calculated by adding the ViewPreset's
defaultSpan to the startDate.
If this is set to false, the preset change will result in a call to
zoomToLevel without any options. The default behaviour
of zoom functionality is to keep the timespan about the same width. If you want to change ViewPreset/Zoom
without any changes to the visible timespan, you can set the
zoomKeepsOriginalTimespan config to true.