CellEdit
Feature
Extends the CellEdit to encapsulate Gantt functionality. This feature is enabled by default
targetElement.innerHTML = '<p>Double-click <b>Name</b> column cells or click the <b>Edit</b> button to start editing:</p>'; // Project contains all the data and is responsible for correct scheduling const project = new ProjectModel({ startDate : new Date(2017, 0, 1), tasks : [ { id : 1, name : 'Write docs', expanded : true, children : [ { id : 2, name : 'Proof-read docs', startDate : '2017-01-02', endDate : '2017-01-05' }, { id : 3, name : 'Release docs', startDate : '2017-01-09', endDate : '2017-01-10' } ] } ], dependencies : [ { fromTask : 2, toTask : 3 } ] }); const gantt = new Gantt({ appendTo : targetElement, layoutStyle : { alignItems : 'stretch', alignContent : 'stretch' }, tbar : [{ type : 'button', text : 'Edit', onClick : ({ source }) => { gantt.startEditing({ field : 'name', record : gantt.selectedRecords.length && gantt.selectedRecords[0] || gantt.taskStore.first }); } }], ref : 'gantt', // reference is used to easily obtain Gantt reference in it's parent container (see Edit button click handler) flex : '1 0 100%', project, // Gantt needs project to get schedule data from startDate : new Date(2016, 11, 31), endDate : new Date(2017, 0, 11), height : 300, columns : [ { type : 'name', field : 'name', text : 'Name' } ] }); Editing can be started by a user by double-clicking an editable cell in the gantt's data grid, or it can be started programmatically by calling startEditing and providing it with correct cell context.
See doAddNewAtEnd.
Instant update
If instantUpdate on the column is set to true, record will be updated instantly as value in the editor is changed. In combination with autoSync it could result in excessive requests to the backend.
Instant update is enabled for these columns by default:
- DurationColumn
- StartDateColumn
- EndDateColumn
- ConstraintDateColumn
- DeadlineDateColumn
- EarlyStartDateColumn
- EarlyEndDateColumn
- LateStartDateColumn
- LateEndDateColumn
To disable instant update on the column set config to false:
new Gantt({
columns: [
{
type: 'startdate',
instantUpdate: false
}
]
})
This feature is enabled by default.
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Set to
trueto select the field text when editing starts -
What action should be taken when focus moves leaves the cell editor, for example when clicking outside. May be
'complete'or'cancel'. -
Class to use as an editor. Default value: Editor
-
See Keyboard shortcuts for details
-
What action should be taken when the editor is scrolled out of view, for example when using a mousewheel to scroll the grid. May be
'complete'or'cancel' ornull.Has a corresponding runtime scrollAction property.
-
Internal listeners, that cannot be removed by the user.
-
Set to
trueto start editing when user starts typing text on a focused cell (as in Excel)Has a corresponding runtime autoEdit property.
-
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 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 CellEdit class, or subclass thereof.
-
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 Localizable 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.
-
What action should be taken when the editor is scrolled out of view, for example when using a mousewheel to scroll the grid. May be
'complete'or'cancel' ornull.Has a corresponding scrollAction config.
-
Identifies an object as an instance of CellEdit class, or subclass thereof.
-
Identifies an object as an instance of GridEditBase class, or subclass thereof.
-
Identifies an object as an instance of InstancePlugin class, or subclass thereof.
-
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?
-
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
-
Cancel editing on widget focusout
-
Cancel edit on touch outside of grid for mobile Safari (focusout not triggering unless you touch something focusable)
-
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.
-
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.
-
Finish editing if clicking below rows (only applies when grid is higher than rows). Also finish if event target is the subgrid which can happen if the pointer is moved during mouse down.
-
Realign editor if grid renders rows while editing is ongoing (as a result to autoCommit or WebSocket data received).
-
Update the input field if underlying data changes during edit.
-
Called when the user triggers the edit action in triggerEvent config. Starts editing.