v7.3.0
SupportExamplesFree Trial

RowEdit
Feature

This feature allows editing of entire rows in a grid in a docked panel which by default slides out from the right.

By default, the editor is docked to the browser viewport, but it can be configured to be local to the grid.

The input fields are generated from the columns in the grid in the same way as the CellEdit, and the editor is a Panel.

// grid with row editing const grid = new Grid({ appendTo : targetElement, height : 600, features : { // cellEditing is enabled by default, so this is necessary cellEdit : false, rowEdit : { // Dock the editor into the grid's element, not the browser viewport local : true } }, showDirty : true, tbar : { items : { instantUpdate : { type : 'checkbox', text : 'Instant Update', tooltip : 'Update record instantly after editing', value : false, onChange : ({ checked }) => { grid.features.rowEdit.instantUpdate = checked; } } } }, data : DataGenerator.generateData(5), columns : [ // basic columns has a TextField as editor by default { field : 'name', text : 'Name', flex : 1, // Invoked on final edit of input field, typically after pressing enter or blurring the field. finalizeCellEdit : ({ value }) => { // returning true will accept the new value otherwise it shows the return statement as error message return value.trim().length < 5 ? 'Name should be at least 5 characters' : true; } }, // a custom editor can be specified { field : 'city', text : 'City', flex : 1, editor : { type : 'combo', items : ['Stockholm', 'New York', 'Montreal'] } }, // column types may specify an editor // NumberColumn for example uses a NumberField { type : 'number', field : 'score', text : 'Score', flex : 1, finalizeCellEdit : ({ value, record }) => { // record contains sibling column's data const { city } = record; // Perform validation based on a sibling column if (city === 'Paris' && value > 999) { return "Score can't be higher than 999 for Paris"; } return true; } }, // specify editor: false to make a column "readonly" { type : 'number', field : 'age', text : 'Age (readonly)', flex : 1, readOnly : true } ] });

By default, the editor works in batch mode. Fields are changed, and when the "Save" button is clicked (or the Enter key pressed), the record is updated with all the changes.

The editor can be configured to update the record as soon as a field is changed by setting the instantUpdate config to true.

Note that the revertOnEscape property of columns is respected, so pressing Escape will revert the field to the value of the field on focus.

Pressing Escape on a field which has not been changed will cancel the edit and close the editor.

To start editing a row, double-click a cell in the row, or press Enter or F2 when a cell is focused.

The start gesture can be configured by setting the triggerEvent config to 'cellClick' or 'cellDblClick'.

Editing can be prevented by setting the ignoreCSSSelector config to a CSS selector which matches elements that should not trigger editing.

Pressing Enter or clicking the "Save" button will save the changes and close the editor. Pressing Escape or clicking the "Cancel" button will close the editor without saving changes.

If instantUpdate is true, the record will be updated as soon as a field is changed (on blur or when changed by trigger action such as spin up or down in a number or date or time field), so Escape and the "Cancel" button revert the changes before closing the editor.

Clicking outside the editor will normally cancel the ongoing edit and start a new one on the clicked cell. This can be prevented by setting the continueEditingOnCellClick config to false.

This feature is disabled by default

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • The Panel instance used as the editor.

    Has a corresponding runtime editor property.

  • Set to true to update the record as soon as a field is changed.

  • local : Booleanfalse

    Configure this as true to dock the editor to the grid's element instead of the browser viewport.

  • Internal listeners, that cannot be removed by the user.

  • Set to true to start editing when user starts typing text on a focused cell (as in Excel)

    Has a corresponding runtime autoEdit property.

  • ignoreCSSSelector : Stringbutton,.b-icon,.fa,svg,input,.b-widget
    GridEditBase

    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 false to disable localization of this object.

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isDelayable : Booleantrue
    READONLY
    static
    ADVANCED
    Delayable
    Identifies an object as an instance of Delayable class, or subclass thereof.
  • isEvents : Booleantrue
    READONLY
    static
    ADVANCED
    Events
    Identifies an object as an instance of Events class, or subclass thereof.
  • isLocalizable : Booleantrue
    READONLY
    static
    ADVANCED
    Localizable
    Identifies an object as an instance of Localizable class, or subclass thereof.
  • isRowEdit : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of RowEdit class, or subclass thereof.
  • properties : Object
    internal
    static
    GridEditBase

    A class property getter for the default values of internal properties for this class.

  • The Panel instance used as the editor.

    Has a corresponding editor config.

  • emptyArray : Array
    internal
    READONLY
    GridEditBase

    An empty array that can be used as a default value.

  • emptyObject : Object
    internal
    READONLY
    GridEditBase

    An empty object that can be used as a default value.

  • isGridEditBase : Booleantrue
    READONLY
    ADVANCED
    GridEditBase
    Identifies an object as an instance of GridEditBase class, or subclass thereof.
  • isInstancePlugin : Booleantrue
    READONLY
    ADVANCED
    GridEditBase
    Identifies an object as an instance of InstancePlugin class, or subclass thereof.
  • isRowEdit : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of RowEdit class, or subclass thereof.
  • Returns the record currently being edited, or null

  • Set to true to start editing when user starts typing text on a focused cell (as in Excel)

    Has a corresponding autoEdit config.

  • Is editing currently active?

  • config : Object
    READONLY
    ADVANCED
    GridEditBase

    Returns a copy of the full configuration which was used to configure this object.

  • isConstructing : Boolean
    READONLY
    ADVANCED
    GridEditBase

    This property is set to true before the constructor returns.

  • isDestroying : Boolean
    READONLY
    ADVANCED
    GridEditBase

    This property is set to true on entry to the destroy method. It remains on the objects after returning from destroy(). If isDestroyed is true, this property will also be true, so there is no need to test for both (for example, comp.isDestroying || comp.isDestroyed).

  • client : Widget
    READONLY
    ADVANCED
    GridEditBase

    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
  • onClassMixedIn( )
    internal
    static
    GridEditBase

    This optional class method is called when a class is mixed in using the mixin() method.

  • initClass( )
    static
    ADVANCED
    GridEditBase

    Registers this class type with its Factory

  • Internal function used to hook destroy() calls when using thisObj

  • Internal function used restore hooked destroy() calls when using thisObj

  • doDestroy( )
    internal
    Events

    Auto detaches listeners registered from start, if set as detachable

  • once( )
    private
    Events

    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.

  • onCellClick( )
    private
    ASYNC
    GridEditBase

    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.

  • onElementClick( )
    private
    ASYNC

    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.

  • Update the input field if underlying data changes during edit.

  • Called when the user triggers the edit action in triggerEvent config. Starts editing.

Events

Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

Event handlers

Event handlers are callbacks called as a result of certain actions in this class

Type definitions

id: rowEdit

Source path

Grid/feature/RowEdit.js

Demo

examples/rowedit

Contents