class_docstr: A :class:`~perspective.View` object represents a specific transform
  (pivot, filter, sort, etc) configuration on an underlying
  :class:`~perspective.Table`.  :class:`~perspective.View` objects
  cannot be directly instantiated - they must be derived from an existing
  :class:`~perspective.Table` via the :func:`~perspective.Table.view()`
  method.
  
  :class:`~perspective.View` instances receive all updates from the
  :class:`~perspective.Table` from which they are derived, and can be
  serialized (via ``to_*`` methods) or trigger a callback when it is updated.
  :class:`~perspective.View` objects will remain in memory and actively
  process updates until :obj:`~perspective.View.delete()` method is called.
class_docstr_tok: ["A",":","class",":","`","~perspective.View","`","object","represents","a","specific","transform","(","pivot",",","filter",",","sort",",","etc",")","configuration","on","an","underlying",":","class",":","`","~perspective.Table","`",".",":","class",":","`","~perspective.View","`","objects","can","not","be","directly","instantiated","-","they","must","be","derived","from","an","existing",":","class",":","`","~perspective.Table","`","via","the",":","func",":","`","~perspective.Table.view","(",")","`","method",".",":","class",":","`","~perspective.View","`","instances","receive","all","updates","from","the",":","class",":","`","~perspective.Table","`","from","which","they","are","derived",",","and","can","be","serialized","(","via","``","to_","*","``","methods",")","or","trigger","a","callback","when","it","is","updated",".",":","class",":","`","~perspective.View","`","objects","will","remain","in","memory","and","actively","process","updates","until",":","obj",":","`","~perspective.View.delete","(",")","`","method","is","called","."]
docstr: Add a callback to be fired when :func:`perspective.Table.update()` is
  called on the parent :class:`~perspective.Table`.
  
  Multiple callbacks can be set through calling ``on_update`` multiple
  times, and will be called in the order they are set. Callback must be a
  callable function that takes exactly 1 or 2 parameters, depending on
  whether `on_update` is called with `mode="row"`. The first parameter is
  always `port_id`, an :obj:`int` that indicates which input port the
  update comes from. A `RuntimeError` will be thrown if the callback
  has mis-configured parameters.
  
  Args:
      callback (:obj:`callable`): a callable function reference that will
          be called when :func:`perspective.Table.update()` is called.
      mode (:obj:`str`): if set to "row", the callback will be passed
          an Arrow-serialized dataset of the rows that were updated.
          Defaults to "none".
  
  Examples:
      >>> def updater(port_id):
      ...     print("Update fired on port", port_id)
      >>> def updater_with_delta(port_id, delta):
      ...     print("Update on port", port_id, "delta len:", len(delta)))
      >>> view.on_update(updater)
      >>> view.on_update(updater, mode="row")
      >>> table.update({"a": [1]})'
      >>> Update fired on port 0
      >>> Update on port 0 delta len: 64
docstr_tok: ["Add","a","callback","to","be","fired","when",":","func",":","`","perspective.Table.update","(",")","`","is","called","on","the","parent",":","class",":","`","~perspective.Table","`",".","Multiple","callbacks","can","be","set","through","calling","``","on_update","``","multiple","times",",","and","will","be","called","in","the","order","they","are","set",".","Callback","must","be","a","callable","function","that","takes","exactly","1","or","2","parameters",",","depending","on","whether","`","on_update","`","is","called","with","`","mode=","''","row","''","`",".","The","first","parameter","is","always","`","port_id","`",",","an",":","obj",":","`","int","`","that","indicates","which","input","port","the","update","comes","from",".","A","`","RuntimeError","`","will","be","thrown","if","the","callback","has","mis-configured","parameters",".","Args",":","callback","(",":","obj",":","`","callable","`",")",":","a","callable","function","reference","that","will","be","called","when",":","func",":","`","perspective.Table.update","(",")","`","is","called",".","mode","(",":","obj",":","`","str","`",")",":","if","set","to","``","row","''",",","the","callback","will","be","passed","an","Arrow-serialized","dataset","of","the","rows","that","were","updated",".","Defaults","to","``","none","''",".","Examples",":",">",">",">","def","updater","(","port_id",")",":","...","print","(","``","Update","fired","on","port","''",",","port_id",")",">",">",">","def","updater_with_delta","(","port_id",",","delta",")",":","...","print","(","``","Update","on","port","''",",","port_id",",","``","delta","len",":","''",",","len","(","delta",")",")",")",">",">",">","view.on_update","(","updater",")",">",">",">","view.on_update","(","updater",",","mode=","''","row","''",")",">",">",">","table.update","(","{","``","a","''",":","[","1","]","}",")","'",">",">",">","Update","fired","on","port","0",">",">",">","Update","on","port","0","delta","len",":","64"]
code: def on_update(self, callback, mode=None):
      """Add a callback to be fired when :func:`perspective.Table.update()` is
      called on the parent :class:`~perspective.Table`.
  
      Multiple callbacks can be set through calling ``on_update`` multiple
      times, and will be called in the order they are set. Callback must be a
      callable function that takes exactly 1 or 2 parameters, depending on
      whether `on_update` is called with `mode="row"`. The first parameter is
      always `port_id`, an :obj:`int` that indicates which input port the
      update comes from. A `RuntimeError` will be thrown if the callback
      has mis-configured parameters.
  
      Args:
          callback (:obj:`callable`): a callable function reference that will
              be called when :func:`perspective.Table.update()` is called.
          mode (:obj:`str`): if set to "row", the callback will be passed
              an Arrow-serialized dataset of the rows that were updated.
              Defaults to "none".
  
      Examples:
          >>> def updater(port_id):
          ...     print("Update fired on port", port_id)
          >>> def updater_with_delta(port_id, delta):
          ...     print("Update on port", port_id, "delta len:", len(delta)))
          >>> view.on_update(updater)
          >>> view.on_update(updater, mode="row")
          >>> table.update({"a": [1]})'
          >>> Update fired on port 0
          >>> Update on port 0 delta len: 64
      """
      self._table._state_manager.call_process(
          self._table._table.get_id()
      )
      mode = mode or "none"
  
      if not callable(callback):
          raise ValueError(
              "Invalid callback - must be a callable function"
          )
  
      if mode not in ["none", "row"]:
          raise ValueError(
              'Invalid update mode {} - valid on_update modes are "none" or "row"'.format(
                  mode
              )
          )
  
      if mode == "row":
          if not self._view._get_deltas_enabled():
              self._view._set_deltas_enabled(True)
  
      wrapped_callback = partial(
          self._wrapped_on_update_callback, mode=mode, callback=callback
      )
  
      self._update_callbacks.add_callback(
          {
              "name": self._name,
              "orig_callback": callback,
              "callback": wrapped_callback,
          }
      )
  
imports: import pandas
  import json
  import datetime
  from functools import partial, wraps
  from random import random
  from .view_config import ViewConfig
  from ._data_formatter import to_format, _parse_format_options
  from ._constants import COLUMN_SEPARATOR_STRING
  from ._utils import _str_to_pythontype
  from ._callback_cache import _PerspectiveCallBackCache
  from ._date_validator import _PerspectiveDateValidator
  from .libpsppy import make_view_unit, make_view_zero, make_view_one, make_view_two, to_arrow_unit, to_arrow_zero, to_arrow_one, to_arrow_two, to_csv_unit, to_csv_zero, to_csv_one, to_csv_two, get_row_delta_unit, get_row_delta_zero, get_row_delta_one, get_row_delta_two, scalar_to_py
label_desc: Use image node_id 15 for calling the View obj's underlying member method code with example usage: obj.on_update(callback, mode) without return types