Class zebkit.ui.grid.DefEditors <zebkit.ui.grid>

Simple grid cells editors provider implementation. By default the editors provider uses a text field component or check box component as a cell content editor. Check box component is used if a cell data type is boolean, otherwise text filed is applied as the cell editor.

       // grid with tree columns and three rows
       // first and last column will be editable with text field component
       // second column will be editable with check box component
       var grid = new zebkit.ui.grid.Grid([
           ["Text Cell", true, "Text cell"],
           ["Text Cell", false, "Text cell"],
           ["Text Cell", true, "Text cell"]
       ]);

       // make grid cell editable
       grid.setEditorProvider(new zebkit.ui.grid.DefEditors());

It is possible to customize a grid column editor by specifying setting "editors[col]" property value. You can define an UI component that has to be applied as an editor for the given column Also you can disable editing by setting appropriate column editor class to null:

       // grid with tree columns and three rows
       // first and last column will be editable with text field component
       // second column will be editable with check box component
       var grid = new zebkit.ui.grid.Grid([
           ["Text Cell", true, "Text cell"],
           ["Text Cell", false, "Text cell"],
           ["Text Cell", true, "Text cell"]
       ]);

       // grid cell editors provider
       var editorsProvider = new zebkit.ui.grid.DefEditors();

       // disable the first column editing
       editorsProvider.editors[0] = null;

       // make grid cell editable
       grid.setEditorProvider(editorsProvider);
Constructor:
zebkit.ui.grid.DefEditors ( )


public <Object> fetchEditedValue (grid, row, col, data, editor)

Fetch an edited value from the given UI editor component.


Parameters:
  • grid <zebkit.ui.grid.Grid>

    a target grid component

  • row <Integer>

    a grid cell row that has been edited

  • col <Integer>

    a grid cell column that has been edited

  • data <Object>

    an original cell content

  • editor <zebkit.ui.Panel>

    an editor that has been used to edit the given cell


Returns: <Object>

a value that can be applied as a new content of the edited cell content

public <zebkit.ui.Panel> getEditor (grid, row, col, v)

Get an editor UI component to be used for the given cell of the specified grid


Parameters:
  • grid <zebkit.ui.grid.Grid>

    a grid whose cell is going to be edited

  • row <Integer>

    a grid cell row

  • col <Integer>

    a grid cell column

  • v <Object>

    a grid cell model data


Returns: <zebkit.ui.Panel>

an editor UI component to be used to edit the given cell

public <Boolean> shouldCancel (grid, row, col, e)

Test if the specified input event has to canceling the given grid cell editing


Parameters:
Returns: <Boolean>

true if the given input event triggers the given cell editing cancellation

public <Boolean> shouldFinish (grid, row, col, e)

Test if the specified input event has to trigger finishing the given grid cell editing


Parameters:
Returns: <Boolean>

true if the given input event triggers finishing the given cell editing

public <Boolean> shouldStart (grid, row, col, e)

Test if the specified input event has to trigger the given grid cell editing


Parameters:
Returns: <Boolean>

true if the given input event triggers the given cell editing