Package s3 :: Module s3widgets :: Class S3CascadeSelectWidget
[frames] | no frames]

Class S3CascadeSelectWidget

source code

??-285 --+
         |
        S3CascadeSelectWidget

Cascade Selector for Hierarchies

Instance Methods
 
__init__(self, lookup=None, formstyle=None, levels=None, multiple=False, filter=None, leafonly=True, cascade=None, represent=None, inline=False)
Constructor
source code
 
__call__(self, field, value, **attr)
Widget renderer
source code
 
hidden_input(self, input_id, field, value, **attr)
Construct the hidden (real) input and populate it with the current field value
source code
 
parse(self, value)
Value parser for the hidden input field of the widget
source code
Static Methods
 
inject_script(widget_id, options)
Inject static JS and instantiate client-side UI widget
source code
Method Details

__init__(self, lookup=None, formstyle=None, levels=None, multiple=False, filter=None, leafonly=True, cascade=None, represent=None, inline=False)
(Constructor)

source code 

Constructor

Parameters:
  • lookup - the name of the hierarchical lookup-table
  • formstyle - the formstyle to use for the inline-selectors (defaults to s3.crud.formstyle)
  • levels - list of labels for the hierarchy levels, in top-down order
  • multiple - allow selection of multiple options
  • filter - resource filter expression to filter the selectable options
  • leafonly - allow only leaf-nodes to be selected
  • cascade - automatically select child-nodes when a parent node is selected (override option, implied by leafonly if not set explicitly)
  • represent - representation function for the nodes (defaults to the represent of the field)
  • inline - formstyle uses inline-labels, so add a colon

__call__(self, field, value, **attr)
(Call operator)

source code 

Widget renderer

Parameters:
  • field - the Field
  • value - the current value(s)
  • attr - additional HTML attributes for the widget

hidden_input(self, input_id, field, value, **attr)

source code 

Construct the hidden (real) input and populate it with the current field value

Parameters:
  • input_id - the DOM-ID for the input
  • field - the Field
  • value - the current value
  • attr - widget attributes from caller

inject_script(widget_id, options)
Static Method

source code 

Inject static JS and instantiate client-side UI widget

Parameters:
  • widget_id - the widget ID
  • options - JSON-serializable dict with UI widget options

parse(self, value)

source code 

Value parser for the hidden input field of the widget

Parameters:
  • value - the value received from the client, JSON string
Returns:
a list (if multiple=True) or the value