GridEditBase
Abstract
Base for features, which edit the grid.
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
The plugin/feature
disabledstate.For a feature that is off by default that you want to enable later during runtime, configure it with
disabled : true.const grid = new Grid({ features : { featureName : { disabled : true // on and disabled, can be enabled later } } }); // enable the feature grid.features.featureName.disabled = false;If the feature is disabled by default, and you want to include and enable the feature, configure it as
true:const grid = new Grid({ features : { featureName : true // on and enabled, can be disabled later } }); // disable the feature grid.features.featureName.disabled = true;If the feature is on by default, but you want to turn it off, configure it as
false:const grid = new Grid({ features : { featureName : false // turned off, not included at all } });If the feature is enabled by default and you have no need of reconfiguring it, you can omit the feature configuration.
Has a corresponding runtime disabled property.
-
The listener set for this object.
An object whose property names are the names of events to handle, or options which modifiy how the handlers are called.
See addListener for details about the options.
Listeners can be specified in target class config and they will be merged with any listeners specified in the instantiation config. Class listeners will be fired first:
class MyStore extends Store({ static configurable = { listeners : { myCustomEvent() { }, load : { prio : 10000, fn() { // this load listener handles things first } } } }; }); let store = new MyStore({ listeners: { load: () => { // This load listener runs after the class's }, ... } });Handlers as function name
Object event handlers may be specified as a function name. If a string is specified, it is the name of the function in the
thisObjobject.If the string begins with
up., this object's ownership hierarchy (if present) is scanned for an object which implements that function name:new Popup({ tbar : { items : { myCombo : { type : 'combo', editable : false, label : 'Type', listeners : { // Look in owner chain for this function name change : 'up.onFilterChange' }, items : [ 'Event', 'Task', 'Appointment' ] } } }, items : { ... }, onFilterChange({ value }) { // Handle event type selection here } }); -
Set to
trueto start editing when user starts typing text on a focused cell (as in Excel)Has a corresponding runtime autoEdit property.
-
By default, while editing, clicking on a grid cell outside the editor will commence editing for the clicked cell context.
Set to
falseto stop editing when clicking another cell while editing. -
A CSS selector for elements that when clicked, should not trigger editing. Useful if you render actionable icons or buttons into a grid cell.
-
The name of the grid event that will trigger cell editing. Defaults to celldblclick but can be changed to any other event, such as cellclick.
features : { cellEdit : { triggerEvent : 'cellclick' } } -
By default, if an event handler throws an exception, the error propagates up the stack and the application state is undefined. Code which follows the event handler will not be executed.
Set this to
trueto catch exceptions thrown by this object's event handlers and continue processing the event. The exception will be rethrown on a zero millisecond timeout, so it will not destroy the stack.Has a corresponding runtime catchEventHandlerExceptions property.
-
Internal listeners, that cannot be removed by the user.
-
An object where property names with a truthy value indicate which events should bubble up the ownership hierarchy when triggered.
const container = new Container({ items : [ { type : 'text', bubbleEvents : { change : true }} ], listeners : { change() { // Will catch change event from the text field } } }); -
Set to
trueto call onXXX method names (e.g.onShow,onClick), as an easy way to listen for events.const container = new Container({ callOnFunctions : true onHide() { // Do something when the 'hide' event is fired } });Has a corresponding runtime callOnFunctions property.
-
The widget which this plugin is to attach to.
Has a corresponding runtime client property.
-
A class translations of which are used for translating this entity. This is often used when translations of an item are defined on its container class. For example:
// Toolbar class that has some predefined items class MyToolbar extends Toolbar { static $name = 'MyToolbar'; static configurable = { // this specifies default configs for the items defaults : { // will tell items to use the toolbar locale localeClass : this }, items : { // The toolbar has 2 buttons and translation for their texts will be searched in // the toolbar locales agree :{ text : 'Agree' }, disagree :{ text : 'Disagree' } } }; ... }So if one makes a locale for the
MyToolbarclass that will includeAgreeandDisagreestring translations:... MyToolbar : { Agree : 'Yes, I agree', Disagree : 'No, I do not agree' }They will be used for the toolbar buttons and the button captions will say
Yes, I agreeandNo, I do not agree. -
Set to
falseto disable localization of this object. -
List of properties which values should be translated automatically upon a locale applying. In case there is a need to localize not typical value (not a String value or a field with re-defined setter/getter), you could use 'localeKey' meta configuration. Example:
static configurable = { localizableProperties : ['width'], width : { value : '54em', // default value here $config : { localeKey : 'L{editorWidth}' // name of the property that will be used in localization file } } };
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of Delayable class, or subclass thereof.
-
Identifies an object as an instance of Events class, or subclass thereof.
-
Identifies an object as an instance of GridEditBase class, or subclass thereof.
-
Identifies an object as an instance of Localizable class, or subclass thereof.
-
A class property getter for the configuration properties of the class, which can be overridden by configurations passed at construction time.
Unlike a normal
staticproperty, this property is only ever used for the class that defines it (as in,hasOwnProperty). It is retrieved for all classes in a class hierarchy, to gather their configs individually and then combine them with those of derived classes.For example, a
Labelmight declare atextconfig like so:class Label extends Base { static configurable = { text : null }; }The
textconfig is automatically inherited by classes derived from Label. By implementingget configurable(), derived classes can change the default value of inherited configs, or define new configs, or both.When a config property is declared in this way, the class author can also implement either of two special methods that will be called when the config property is assigned a new value:
changeText()updateText()
In the example above, the
Labelclass could implement achangeText()method, anupdateText()method, or both. The generated property setter ensures these methods will be called when thetextproperty is assigned.The generated setter (for
textin this example) performs the following steps:- If the class defines a
changeText()method, call it passing the new value and the current value:changeText(newText, oldText).
Then:- If
changeText()exits without returning a value (i.e.,undefined), exit and do nothing further. The assumption is that the changer method has done all that is required. - Otherwise, the return value of
changeText()replaces the incoming value passed to the setter.
- If
- If the new value (or the value returned by
changeText()) is!==to the current value:- Update the stored config value in
this._text. - If the class defines an
updateText()method, call it passing the new value and the previous value.updateText(newText, oldText)
- Update the stored config value in
Resolving a value from an owner
By specifying a value starting with
'up.'for a config, the config system will resolve that value by examining the ownership hierarchy. It will walk up the hierarchy looking for a property matching the name (or dot separated path) after 'up.'. If one is found, the value will be read and used as the initial value.class Parent extends Base { static get configurable() { return [ 'importantValue' ] } } class Child extends Base { static get configurable() { return [ 'value' ] } } const parent = new Parent({ importantValue : 123 }); const child = new Child({ owner : parent, // Will be resolved from the owner value : 'up.importantValue' }); console.log(child.value); // logs 123Please note that this is for now a one way one time binding, the value will only be read initially and not kept up to date on later changes.
Value Merging
When a config property value is an object, the value declared by the base class is merged with values declared by derived classes and the value passed to the constructor.
class Example extends Base { static configurable = { config : { foo : 1, bar : 2 } }; } class Example2 extends Example { static configurable = { config : { bar : 42, zip : 'abc' } }; } let ex = new Example2({ config : { zip : 'xyz' } });The result of the merge would set
configto:ex.foo = { foo : 1, // from Example bar : 42, // from Example2 zip : 'xyz' // from constructor }Config Options
Some config properties require additional options such as declarative information about the config that may be useful to automate some operation. Consider a
Button. It could declare that itstextconfig affects the rendered HTML by applying arenderproperty to the config definition. Its base class could then examine the config definition to find this property.To support this, config options ca be declared like so:
class Button extends Widget { static configurable = { text : { value : null, $config : { render : true } } }; }The
$configproperty can alternatively be just the names of the options that should be enabled (set totrue).For example, the following is equivalent to the above:
class Button extends Widget { static configurable = { text : { value : null, $config : 'render' } };Default Value
It is common to set a config to a
nullvalue to take advantage of internal optimizations fornullvalues. In most cases the fact that this producesundefinedas the actual initial value of the config is acceptable. When this is not acceptable, a config can be declared like so:class Widget { static configurable = { disabled : { $config : null, value : null, default : false } };The
defaultproperty above determines the value of the config while still gaining the benefits of minimal processing due to thenullvalue of thevalueproperty. -
A class property getter to add additional, special class properties.
For example, a class adds a
declarableclass property like so:class Something extends Base { static get declarable() { return ['extra']; } static setupExtra(cls, meta) { // use cls.extra } }A derived class can then specify this property like so:
class Derived extends Something { static get extra() { // return extra information } }When the
Derivedclass is initialized, thesetupExtra()method is called andDerivedis passed as the argument. It is also thethispointer, but the parameter is minifiable. The second argument passed is the$metaobject for the class.Classes are initialized at the first occurrence of the following:
- An instance is created
- The class
$metaproperty is accessed
-
A legacy class property getter for the default configuration of the class, which can be overridden by configurations passed at construction time. We recommend using
configurableinstead.Unlike a normal
staticproperty, this property is only ever used for the class that defines it (as in,hasOwnProperty). It is retrieved for all classes in a class hierarchy, to gather their configs individually and then combine them with those of derived classes.For example, a
Storemight declare itsurlconfig like so:class Store extends Base { static get defaultConfig() { return { url : null }; } }The
urlconfig is automatically inherited by classes derived from Store. By implementingget defaultConfig(), derived classes can change the default value of inherited configs, or define new configs, or both. When defining new configs, however,configurableis preferred.Config properties introduced to a class by this declaration do not participate in value merging and do not get a generated setter. Config properties introduced by a base class using
configurablecan be set to a different value usingdefaultConfigand in doing so, the values will be merged as appropriate forconfigurable. -
A class property getter for the default values of internal properties for this class.
-
This class property returns an object that specifies methods to wrap with configurable timer behaviors.
It is used like so:
class Foo extends Base.mixin(Delayable) { static get delayable() { return { expensiveMethod : 500 }; } expensiveMethod() { this.things(); this.moreThings(); this.evenMoreThings(); } }With the above in place, consider:
let instance = new Foo(); instance.expensiveMethod();Instead of the above code immediately calling the
expensiveMethod(), it will start a timer that will invoke the method 500ms later. BecauseexpensiveMethod()is an instance method, each instance ofFoowill have its own timer.NOTE: Only instance methods are currently supported (i.e., only non-
staticmethods).Options
The value of each key configures how the method will be scheduled. If the value is a number, it is promoted to a config object of
type='buffer'as in the following:class Foo extends Base.mixin(Delayable) { static get delayable() { return { expensiveMethod : { type : 'buffer', delay : 500 } }; } }The
typeproperty of the config object must be one of three values. Other options can be provided depending on thetype:buffer
Other options:delay(Number) : The number of milliseconds to wait before calling the underlying method. A value of 0 is equivalent to settingimmediate: true.immediate(Boolean) : Set totrueto call immediately (effectively disabling the buffer).
raf(short for "request animation frame")idle(short for "request idle callback") Not available on Safari
Other options:cancelOutstanding(Boolean) : Set totrueto cancel any pending animation frame requests and schedule a new one on each call.immediate(Boolean) : Set totrueto call immediately.
throttle
Other options:delay(Number) : The number of milliseconds to wait after each execution before another execution takes place. A value of 0 is equivalent to settingimmediate: true.immediate(Boolean) : Set totrueto call immediately (effectively disabling the throttle).
While
immediate: truecan be specified at the class level, it is more typical to set it on the instance's method as described below.Delayable Method API
Delayable methods have a consistent API to manage their scheduling. This API is added to the methods themselves.
For example:
let instance = new Foo(); instance.expensiveMethod(); // schedule a call in 500ms instance.expensiveMethod.isPending; // true instance.expensiveMethod.cancel(); instance.expensiveMethod.flush(); instance.expensiveMethod.now(); instance.expensiveMethod.delay = 10; instance.expensiveMethod(); // schedule a call in 10msisPending(Boolean, readonly)This boolean property will be
trueif a call has been scheduled, and false otherwise.cancel()Cancels a pending call if one has been scheduled. Otherwise this method does nothing.
flush()Cancels the timer and causes the pending call to execute immediately. If there is no pending call, this method does nothing.
now()Cancels the timer (if one is pending) and executes the method immediately. If there is no pending call, this method will still call the underlying method.
-
An object owned by this class that does not share properties with its super class. This object may contain other properties which are added as needed and are not documented here.
- class : Function
The class constructor that owns the meta object
- super : Object
The
$metaobject for the super class. This isnullforBase - config : Object
The object holding the default configuration values for this class
- configs : Object
An object keyed by config name that holds the defined configs for the class The value of each property is a Config instance
- forkConfigs : Boolean
This will be
trueif the default configuration values for this class (in theconfigproperty of the meta object) must be forked to avoid object sharing, or if the object can be passed toObject.create()for efficiency - hierarchy : Function[]
The array of classes in the ancestry of this class. This will start with
Baseat index 0 and ends with this class - properties : Function[]
The array of classes that define a "static get properties()" getter
- class : Function
-
Defines how the plugin's methods integrate with its client (the widget it is attached to). Override this static getter in subclasses.
class MyFeature extends InstancePlugin { static get pluginConfig() { return { assign : ['newMethod'], // client.newMethod() calls plugin before : ['onElementKeyDown'], // plugin runs first after : ['onElementClick'], // client runs first override : ['processData'] // plugin replaces, uses this.overridden }; } processData(data) { // Call original: this.overridden.processData(data) return this.overridden.processData(this.transform(data)); } }
-
The plugin/feature
disabledstate.For a feature that is off by default that you want to enable later during runtime, configure it with
disabled : true.const grid = new Grid({ features : { featureName : { disabled : true // on and disabled, can be enabled later } } }); // enable the feature grid.features.featureName.disabled = false;If the feature is disabled by default, and you want to include and enable the feature, configure it as
true:const grid = new Grid({ features : { featureName : true // on and enabled, can be disabled later } }); // disable the feature grid.features.featureName.disabled = true;If the feature is on by default, but you want to turn it off, configure it as
false:const grid = new Grid({ features : { featureName : false // turned off, not included at all } });If the feature is enabled by default and you have no need of reconfiguring it, you can omit the feature configuration.
Has a corresponding disabled config.
-
Returns the record currently being edited, or
null -
Set to
trueto start editing when user starts typing text on a focused cell (as in Excel)Has a corresponding autoEdit config.
-
Is editing currently active?
-
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 GridEditBase class, or subclass thereof.
-
Identifies an object as an instance of InstancePlugin class, or subclass thereof.
-
By default, if an event handler throws an exception, the error propagates up the stack and the application state is undefined. Code which follows the event handler will not be executed.
Set this to
trueto catch exceptions thrown by this object's event handlers and continue processing the event. The exception will be rethrown on a zero millisecond timeout, so it will not destroy the stack.Has a corresponding catchEventHandlerExceptions config.
-
Simple wrapper for disabled to make optional chaining simple:
grid.features.myFeature?.enabled // returns true when feature exists and is enabled -
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
trueby destroy after destruction.It is also one of the few properties that remains on the object after returning from
destroy(). This property is often checked in code paths that may encounter a destroyed object (like some event handlers) or in the destruction path during cleanup. -
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). -
Set to
trueto call onXXX method names (e.g.onShow,onClick), as an easy way to listen for events.const container = new Container({ callOnFunctions : true onHide() { // Do something when the 'hide' event is fired } });Has a corresponding callOnFunctions config.
-
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-
Determines if the specified config property exists in an instance of Base
-
Returns the merge of the
baseConfigandconfigconfig objects based on the configs defined by this class. -
Factory version of the Base constructor. Merges all arguments to create a config object that is passed along to the constructor.
-
This optional class method is called when a class is mixed in using the mixin() method.
-
Merges the provided default configuration values with the existing defaults for this class (and its subclasses).
This method allows you to define additional or override existing default property values that apply to all instances of the class.
// All my input fields should be clearable Field.applyDefaults({ clearable : true }); -
Gets the full defaultConfig block for this object's entire inheritance chain all the way up to but not including Base
-
This method is called as part of
setupClass(). It will process theconfigurable()return object and thedefaultConfigreturn object. -
This method initializes the
delayablemethods on this class. -
Call from another instance to add a plugin to it
-
Call from another instance to add plugins to it.
InstancePlugin.initPlugins(this, Search, Stripe); -
Destroys the provided objects by calling their destroy method. Skips empty values or objects that are already destroyed.
Base.destroy(myButton, toolbar1, helloWorldMessageBox); -
Get localized string, returns
nullif no localized string found.// Simple localization const someText = SomeClass.localize('L{text}'); // With template data const someText = SomeClass.localize('L{template}', { count : 5 }); // Number in object const someText = SomeClass.localize('L{template}', { name : 'John' }); // String in object const someText = SomeClass.localize('L{template}', 'John'); // Strings parameter -
Registers this class type with its Factory
-
Checks if an obj is of type using object's $name property and doing string comparison of the property with the type parameter.
-
Applies one or more
mixinsto this class and returns the produced class constructor.For example, instead of writing this:
class A extends Delayable(Events(Localizable(Base))) { // ... }Using this method, one would write this:
class A extends Base.mixin(Localizable, Events, Delayable) { // ... }If one of the mixins specified has already been mixed into the class, it will be ignored and not mixed in a second time.
-
This method is called only once for any class. This can occur when the first instance is created or when the
$metaobject is first requested.
-
Base constructor, passes arguments to construct.
-
This method is required to help
unusedgetters to survive production build process. Some tools, like angular, will removeunusedcode in production build, making our side-effected getters behind, breaking code heavily. -
Creates a binding between the specified config properties of this object and the specified
targetobject. Changes to these config properties of this object will be reflected to thetargetobject as they occur, and (optionally), vise-versa.Returns a function to call to remove the binding.
-
Delays the execution of the passed function by the passed time quantum, or if the time is omitted or not a number, delays until the next animation frame. Note that this will use setTimeout || requestAnimationFrame if this class mixes in
Delayable, otherwise it uses the global methods. The function will be called usingthisobject as its execution scope. -
Returns
trueif this instance has a non-null value for the specified config. This will not activate a lazy config. -
Returns the value of an uningested config without ingesting the config or transforming it from its raw value using its
changeXxxxxmethod. -
Tracks a detacher function for the specified listener name.
-
Ensures that the specified config is initialized if it is needed. If there is a config value specified, and it was initialized by this call, this method returns
true. If there was a config value specified, and it was already initialized, this method returnsfalse. If there was no value specified for the given config, this method returnsnull.This is not the same as just reading the property, because some property getters exist that do not actually just read the config value back, but instead produce some result. Reading such properties to incidentally trigger a possible config initializer can lead to incorrect results. For example, the Combo items config.
-
This call will activate any pending lazy configs that were assigned a string value equal to the
groupparameter. -
Removes all detacher functions for the specified
Eventsobject. This is called by theremoveAllListenersmethod on that object which is typically called by itsdestroyinvocation. -
This is intended to set a block of configs during configuration. It is not intended to be used outside of the configuration phase.
If any of the properties are not yet ingested from the configuration object, they will be set and ingested in the normal order.
Properties which are already ingested are set immediately.
-
Used by the Widget and GridFeatureManager class internally. Returns the class hierarchy of this object starting from the
topClassclass (which defaults toBase).For example
classHierarchy(Widget)on a Combo would yield[Widget, Field, TextField, PickerField, Combo] -
Returns the value of the specified config property. This is a method to allow property getters to be explicitly called in a way that does not get optimized out.
The following triggers the getter call, but optimizers will remove it:
inst.foo; // also raises "expression has no side-effects" warningInstead, do the following to trigger a getter:
inst.getConfig('foo'); -
Gets the full properties block for this class's entire inheritance chain all the way up to but not including Base
-
This method is called when any config changes.
-
Returns a function that when called will schedule a call to
fnvia queueMicrotask. -
Wraps a function with another function that delays it specified amount of time, repeated calls to the wrapper resets delay.
-
Relays to native cancelAnimationFrame and removes from tracking.
-
Relays to native cancelIdleCallback and removes from tracking.
-
Given the return value from a call to queueMicrotask, cancels the pending call. This method is provided for symmetry with other timer functions, such as setTimeout.
-
clearInterval wrapper
-
clearTimeout wrapper, either call with timeout id as normal clearTimeout or with timeout name (if you specified a name to setTimeout()) property to null.
-
Creates a function which will execute once, on the next animation frame. However many time it is called in one event run, it will only be scheduled to run once.
-
Decorates the supported
wrapFnwith additional methods and anisPendingreadonly property. These decorations are available to user code to help manage the scheduling behavior of the buffered function. -
Check if a named timeout is active
-
Creates and returns a function that will call the user-supplied
fn. -
Equivalent to the native
queueMicrotask, but will be cancelled automatically ondestroy. WhenqueueMicrotaskis not available, the providedfnis called usingPromise.resolve().then(fn), which behaves similarly.Returns a function that when called will cancel the impending call. This function can also be viewed as a timer id that can be passed to cancelMicrotask
-
Returns a function that when called will schedule a call to
fnon the next animation frame. -
Relays to native requestAnimationFrame and adds to tracking to have call automatically canceled on destroy.
-
Relays to native requestIdleCallback and adds to tracking to have call automatically canceled on destroy.
-
Same as native setInterval, but will be cleared automatically on destroy
-
Same as native setTimeout, but will be cleared automatically on destroy. If a propertyName is supplied it will be used to store the timeout id.
-
Create a "debounced" function which will call on the "leading edge" of a timer period. When first invoked will call immediately, but invocations after that inside its buffer period will be rejected, and one invocation will be made after the buffer period has expired.
This is useful for responding immediately to a first mousemove, but from then on, only calling the action function on a regular timer while the mouse continues to move.
-
Adds an event listener. This method accepts parameters in the following format:
myObject.addListener({ thisObj : this, // The this reference for the handlers eventname2 : 'functionName' // Resolved at invocation time using the thisObj, otherevent : { fn : 'handlerFnName', once : true // Just this handler is auto-removed on fire }, yetanother : { fn : 'yetAnotherHandler', args : [ currentState1, currentState2 ] // Capture info to be passed to handler }, prio : 100 // Higher prio listeners are called before lower });When listeners have a
thisObjoption, they are linked to the lifecycle of that object. When it is destroyed, those listeners are removed.The
configparameter allows supplying options for the listener(s), for available options see BryntumListenerConfig.A simpler signature may be used when only adding a listener for one event and no extra options (such as
onceordelay) are required:myObject.addListener('click', myController.handleClicks, myController);The args in this simple case are
eventName,handlerandthisObjBy default, if an event handler throws an exception, the error propagates up the stack and the application state is undefined. Code which follows the event handler will not be executed. Set the catchEventHandlerExceptions config to
trueto catch exceptions thrown by this object's event handlers and allow the event to continue processing. The exception will be rethrown on a zero millisecond timeout, -
Internal function used to hook destroy() calls when using thisObj
-
Internal function used restore hooked destroy() calls when using thisObj
-
Removes all event listeners that were registered with the passed names.
-
Auto detaches listeners registered from start, if set as detachable
-
Finds the index of a particular listener to the named event. Returns
-1if the passed function/thisObj listener is not present. -
Returns
trueif any listener is registered for the specifiedeventName, or ifnull, for any event. -
Internal convenience method for adding an internal listener, that cannot be removed by the user.
Alias for
on({ $internal : true, ... }). Only supports single argument form. -
Returns the number of attached listener for the specified
eventName, or ifnull, for any event. -
Alias for addListener. Adds an event listener. This method accepts parameters in the following format:
myObject.on({ thisObj : this, // The this reference for the handlers eventname2 : 'functionName' // Resolved at invocation time using the thisObj, otherevent : { fn : 'handlerFnName', once : true // Just this handler is auto-removed on fire }, yetanother : { fn : 'yetAnotherHandler', args : [ currentState1, currentState2 ] // Capture info to be passed to handler }, prio : 100 // Higher prio listeners are called before lower });When listeners have a
thisObjoption, they are linked to the lifecycle of that object. When it is destroyed, those listeners are removed.The
configparameter allows supplying options for the listener(s), for available options see BryntumListenerConfig.A simpler signature may be used when only adding a listener for one event and no extra options (such as
onceordelay) are required:myObject.on('click', myController.handleClicks, myController);The args in this simple case are
eventName,handlerandthisObj -
This method is called when the first listener for an event is added.
-
This method is called when the last listener for an event is removed.
-
Internal function used to run a callback function after an event is triggered
-
Relays all events through another object that also implements Events mixin. Adds a prefix to the event name before relaying, for example add -> storeAdd
// Relay all events from store through grid, will make it possible to listen for store events prefixed on grid: 'storeLoad', 'storeChange', 'storeRemoveAll' etc. store.relayAll(grid, 'store'); grid.on('storeLoad', () => console.log('Store loaded'); -
Removes all listeners registered to this object by the application.
-
Removes an event listener. Same API signature as addListener
-
Resume event triggering after a call to suspendEvents(). If any triggered events were queued they will be triggered.
-
Prevents events from being triggered until resumeEvents() is called. Optionally queues events that are triggered while suspended. Multiple calls stack to require matching calls to
resumeEvents()before actually resuming. -
Triggers an event, calling all registered listeners with the supplied arguments. Returning false from any listener makes function return false.
By default, if an event handler throws an exception, the error propagates up the stack and the application state is undefined. Code which follows the event handler will not be executed. Set the catchEventHandlerExceptions config to
trueto catch exceptions thrown by this object's event handlers and allow the event to continue processing. The exception will be rethrown on a zero millisecond timeout, -
Shorthand for removeListener
-
Applies after/before hooks for specified functions.
-
Applies assigning for specified functions.
-
Applies override for specified functions.
-
Applies config as found in plugInto.pluginConfig, or published all if no config found.
-
Assigns specified functions.
-
Hooks functions. When the function is called on the target class all functions in the hook chain will be called in the order they were added.
-
Used to run multiple plugged in functions with the same name, see after() above. Returning false from a function will abort the hook chain.
-
This will merge a feature's (subclass of InstancePlugin) keyMap with it's client's keyMap.
-
Starts editing if user taps selected cell again on touch device. Chained function called when user clicks a cell.
-
Event handler added when editing is active called when user clicks a cell in the grid during editing. It finishes editing and moves editor to the selected cell instead.
-
onStoreUpdate( )private
Update the input field if underlying data changes during edit.
-
Called when the user triggers the edit action in triggerEvent config. Starts editing.
-
Base implementation so that all subclasses and mixins may safely call
super.afterConfigure. This is called by the Base class after the configure method has been called. At this point, all configs have been applied.This method allows all classes in the hierarchy to inject functionality either before or after the super.afterConstruct();
-
Base implementation so that all subclasses and mixins may safely call super.afterConstruct.
This is called by the Base class after the construct method has been called.
At this point, all configs have been applied.
This method allows all classes in the hierarchy to inject functionality either before or after the super.afterConstruct();
-
Called by the Base constructor to apply configs to this instance. This must not be called.
-
Base implementation applies configuration.
Subclasses need only implement this if they have to initialize instance specific properties required by the class. Often a
constructmethod is unnecessary. All initialization of incoming configuration properties can be done in aset propNameimplementation. -
Destroys the named properties if they have been initialized, and if they have a
destroymethod. Deletes the property from this object. For example:this.destroyProperties('store', 'resourceStore', 'eventStore', 'dependencyStore', 'assignmentStore'); -
Base implementation so that all subclasses and mixins may safely call super.finishConfigure.
This is called by the Base class before exiting the configure method.
At this point, all configs have been applied, but the
isConfiguringproperty is still set.This method allows all classes in the hierarchy to inject functionality into the config phase.
-
Sets configuration options this object with all the properties passed in the parameter object. Timing is taken care of. If the setter of one config is called first, and references the value of another config which has not yet been set, that config will be set just in time, and the new value will be used.
-
Base implementation so that all subclasses and mixins may safely call super.startConfigure.
This is called by the Base class before setting configuration properties, but after the active initial getters have been set, so all configurations are available.
This method allows all classes in the hierarchy to force some configs to be evaluated before others.
-
Localization function on the class instance that mixes Localizable.
// Simple localization const someText = someClass.L('L{text}'); // With template data const someText = someClass.L('L{template}', { count : 5 }); // Number in object const someText = someClass.L('L{template}', { name : 'John' }); // String in object const someText = someClass.L('L{template}', 'John'); // Strings parameter -
Changes the value of a numeric property of this object smoothly over the specified duration.
-
Provides a way of calling callbacks which may have been specified as the name of a function and optionally adds scope resolution.
For example, if the callback is specified as a string, then if it is prefixed with
'this.'then the function is resolved in this object. This is useful when configuring listeners at the class level.If the callback name is prefixed with
'up.'then the ownership hierarchy is queried using theownerproperty until an object with the named function is present, then the named function is called upon that object.If a named function is not found, an error is thrown. If the function should be only called when present, and may not be present, add a
?as a suffix. -
Called when disabling/enabling the plugin/feature, not intended to be called directly. To enable or disable a plugin/feature, see disabled.
By default removes the cls of the plugin from its client. Override in subclasses to take any other actions necessary.
-
Experimental helper function, extracts the currently used configs and wraps them as an app, downloading the resulting JS file.
This function is intended to simplify creating test cases for issue reporting on Bryntum's support forum.
-
Localization function to get an optional translation. The difference compared to
L()is that it won't throw an error when the translation is missing even if configured with throwOnMissingLocale.button.text = grid.optionalL('L{text}'); // With template data const someText = someClass.optionalL('L{template}', { count : 5 }); // Number in object const someText = someClass.optionalL('L{template}', { name : 'John' }); // String in object const someText = someClass.optionalL('L{template}', 'John'); // Strings parameter -
Provides a way of locating callbacks which may have been specified as the name of a function and optionally adds scope resolution.
For example, if the callback is specified as a string, then if it is prefixed with
'this.'then the function is resolved in this object. This is useful when configuring listeners at the class level.If the callback name is prefixed with
'up.'then the ownership hierarchy is queried using theownerproperty until an object with the named function is present, then the named function is called upon that object. -
Method that is triggered when applying a locale to the instance (happens on the instance construction steps and when switching to another locale).
The method can be overridden to dynamically translate the instance when locale is switched. When overriding the method please make sure you call
super.updateLocalization().
Events
Events are triggered for certain actions in this class and can be listened for to react to those actions in your code-
Fires before an object is destroyed.
Fires when any other event is fired from the object.
Note:
catchAllis fired for both public and private events. Please rely on the public events only.Fires when an object is destroyed.
Fired when the plugin/feature is disabled.
Fired when the plugin/feature is enabled.
Event handlers
Event handlers are callbacks called as a result of certain actions in this class-
Called before an object is destroyed.
Called when any other event is called from the object.
Note:
catchAllis called for both public and private events. Please rely on the public events only.Called when an object is destroyed.
Called when the plugin/feature is disabled.
Called when the plugin/feature is enabled.
Source path
Grid/feature/base/GridEditBase.jsContents