Edit Input Handling

Last Updated on May 1, 2018 by Neil Murray

Edit handling is added in Visual.editOnChange(). RST component states can be used:

  • rowInfo.node – current edited node
  • treeData – current treeData

Function Parameters

  • event [object] Required, event.target contains:
    – name
    – value
    – checked
    – type
  • optionsArrayType [string] null, create array for rowInfo.node.
  • index [string/integer] null, create object key for optionsArrayType.
  • _rowInfo [object] null, passed row info from child components.

Main Scheme

  • If _rowInfo is passed, update treeData directly.
  • Else, do input handling as described below.

Input Handling

Visual.editOnChange should handle input change properly with following rules:

  1. Check if provided key exists in rowInfo.node. If not, create empty array and push new value.
  2. Check for input type and function parameters:
    • checkbox: rowInfo.node[name] = checked
    • checkbox & optionsArrayType & index: rowInfo.node[optionsArrayType][index].isChecked = checked
    • radio & optionsArrayType & index: rowInfo.node[optionsArrayType][index].isChecked = (bool)
    • range, number: rowInfo.node[name] = parseInt(value,10)
    • text, default: rowInfo.node[name] = value
  3. Deleting/removing all items from array or object should result empty [ ] or { }.
  4. Update treeData and rowInfo

Further reading: Edit Input Handling (BitBucket Issue)