PercentBar
Feature
This feature visualizes the percentDone field as a progress bar on the event elements. Each progress bar also optionally has a drag handle which users can drag can change the value.
You can customize data source for the feature with valueField and displayField configs.
const schedulerPro = new SchedulerPro({ appendTo : targetElement, // makes scheduler as high as it needs to be to fit rows autoHeight : true, startDate : new Date(2022, 2, 23), endDate : new Date(2022, 2, 28), columns : [ { field : 'name', text : 'Name', width : 100 } ], features : { percentBar : true }, project : { resources : [ { id : 1, name : 'George', eventColor : 'blue' }, { id : 2, name : 'Rob', eventColor : 'green' } ], events : [ { id : 1, name : 'Project X', startDate : '2022-03-24', duration : 4, percentDone : 80 }, { id : 2, name : 'Customer Project Y', startDate : '2022-03-23T13:00', duration : 4, percentDone : 40 } ], assignments : [ { id : 1, event : 1, resource : 1 }, { id : 2, event : 2, resource : 2 } ] } }); Restricting resizing for certain tasks
You can prevent certain tasks from having their percent done value changed by overriding the isEditable method on your EventModel or TaskModel.
class MyTaskModel extends TaskModel {
isEditable(field) {
// Add any condition here, `this` refers to the a task instance
return this.field !== 'percentDone' && super.isEditable(field);
}
};
gantt = new Gantt({
project : {
taskModelClass : MyTaskModel
}
});
This feature is enabled by default in Gantt, but off by default in Scheduler Pro.
See also
- PercentDoneMixin — Mixin providing the
percentDonefield - EventModel — The event model whose progress is visualized
- TaskEdit — Full-featured popup editor that also edits percent done
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
trueto allow drag drop resizing to set the % done -
Field name to use to display the value
-
By default, the underlying task record is updated live as the user drags the handle. Set to
falseto only update the record upon drop. -
trueto show a small % done label within the event while drag changing its value -
Field name to use as the data source
-
Internal listeners, that cannot be removed by the user.
-
The widget which this plugin is to attach to.
Has a corresponding runtime client property.
-
Set to
falseto disable localization of this object.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of Events class, or subclass thereof.
-
Identifies an object as an instance of Localizable class, or subclass thereof.
-
Identifies an object as an instance of PercentBar class, or subclass thereof.
-
A class property getter for the default values of internal properties for this class.
-
An empty array that can be used as a default value.
-
An empty object that can be used as a default value.
-
Identifies an object as an instance of InstancePlugin class, or subclass thereof.
-
Identifies an object as an instance of PercentBar class, or subclass thereof.
-
Returns a copy of the full configuration which was used to configure this object.
-
This property is set to
truebefore theconstructorreturns. -
This property is set to
trueon entry to the destroy method. It remains on the objects after returning fromdestroy(). If isDestroyed istrue, this property will also betrue, so there is no need to test for both (for example,comp.isDestroying || comp.isDestroyed). -
The Widget which was passed into the constructor, which is the Widget we are providing extra services for.
Has a corresponding client config.
-
Get the global LocaleHelper
-
Get the global LocaleManager
Functions
Functions are methods available for calling on the class-
This optional class method is called when a class is mixed in using the mixin() method.
-
Registers this class type with its Factory
-
onInternalPaint( )private
Called when scheduler is painted. Sets up drag and drop and hover tooltip.
-
Internal function used to hook destroy() calls when using thisObj
-
Internal function used restore hooked destroy() calls when using thisObj
-
Auto detaches listeners registered from start, if set as detachable
-
Internal function used to run a callback function after an event is triggered
-
Removes all listeners registered to this object by the application.
-
This will merge a feature's (subclass of InstancePlugin) keyMap with it's client's keyMap.
Events
Events are triggered for certain actions in this class and can be listened for to react to those actions in your codeEvent handlers
Event handlers are callbacks called as a result of certain actions in this classCSS variables
CSS variables that can be set to adjust appearance| Name | Description |
|---|---|
| --b-percent-bar-background | Percent bar background. Note that for color-mix to work, this var is defined on .b-task-percent-bar |
| --b-percent-bar-blend-mode | Percent bar blend mode |
| --b-percent-bar-handle-text-color | Percent bar handle text color |
| --b-percent-bar-z-index | Percent bar z-index |