GridFeatureManager
Static class intended to register and query grid features (also applies to Scheduler, Scheduler Pro and Gantt).
A feature for Grid, Scheduler, Scheduler Pro or Gantt must extend InstancePlugin.
Registering a custom feature
First define a new feature, extending InstancePlugin:
export default class MyFeature extends InstancePlugin {
// Class name, needed since the actual class name might be mangled by the minifier
static $name = 'MyFeature';
construct(client, config) {
// Set things up here
}
}
You can supply a construct function to set things up after the feature is plugged into the target component (Grid, Scheduler etc).
Use it to for example register a click listener:
construct(client, config) {
+ EventHelper.on({
+ element : client.element,
+ thisObj : this,
+ click : this.clickCounter,
+ mouseover : this.trackMouse,
+ });
}
+ clickCounter() {}
+ trackMouse() {}
Then register it with GridFeatureManager:
GridFeatureManager.registerFeature(MyFeature);
After that it is ready to use:
const grid = new Grid({
features : {
myFeature : true
}
});
Functions
7
Functions
7Gets all the default features registered for the given instance type name chain. First builds the type name chain then queries for features for each type name and combines them into one object, see getTypeNameFeatures() for returned object description.
If feature is registered for both parent and child type name then feature for child overrides feature for parent.
| Parameter | Type | Description |
|---|---|---|
instance | Object |
Gets all the features registered for the given instance type name chain. First builds the type name chain then queries for features for each type name and combines them into one object, see getTypeNameFeatures() for returned object description.
If feature is registered for both parent and child type name then feature for child overrides feature for parent.
| Parameter | Type | Description |
|---|---|---|
instance | Object |
Get all the default features registered for the given type name in an object where keys are feature names and values are feature constructors.
| Parameter | Type | Description |
|---|---|---|
forType | String |
Get all the features registered for the given type name in an object where keys are feature names and values are feature constructors.
| Parameter | Type | Description |
|---|---|---|
forType | String |
Checks if the given feature class is default for the given instance type name chain. If the feature is not default for the parent type name but it is for the child type name, then the child setting overrides the parent one.
| Parameter | Type | Description |
|---|---|---|
featureClass | InstancePlugin | Feature to check |
forType | String |
Checks if the given feature class is default for the type name
| Parameter | Type | Description |
|---|---|---|
featureClass | InstancePlugin | Feature to check |
forType | String |
Register a feature class with the Grid. Enables it to be created and configured using config Grid#features.
| Parameter | Type | Description |
|---|---|---|
featureClass | function | The feature class constructor to register |
onByDefault | Boolean | Specify true to have the feature enabled per default |
forType | String | String[] | Specify a type to let the class applying the feature to determine if it should use it |