Zebra API Doc

zebra.ui.grid.DefEditors Class

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 zebra.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 zebra.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 zebra.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 zebra.ui.grid.DefEditors();

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

   // make grid cell editable
   grid.setEditorProvider(editorsProvider);

Constructor

zebra.ui.grid.DefEditors

()

Methods

fetchEditedValue

(
  • grid
  • row
  • col
  • data
  • editor
)
Object

Fetch an edited value from the given UI editor component.

Parameters:

  • grid zebra.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 zebra.ui.Panel

    an editor that has been used to edit the given cell


Return: Object

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

getEditor

(
  • grid
  • row
  • col
  • v
)
zebra.ui.Panel

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

Parameters:

  • grid zebra.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


Return: zebra.ui.Panel

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

shouldCancel

(
  • grid
  • row
  • col
  • e
)
Boolean

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

Parameters:


Return: Boolean

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

shouldFinish

(
  • grid
  • row
  • col
  • e
)
Boolean

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

Parameters:


Return: Boolean

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

shouldStart

(
  • grid
  • row
  • col
  • e
)
Boolean

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

Parameters:


Return: Boolean

true if the given input event triggers the given cell editing