Commit bd46d9c8 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update to_panelWithUrlSelector to avoid fixed options.

parent 36c39a45
...@@ -859,13 +859,20 @@ def to_model(table): ...@@ -859,13 +859,20 @@ def to_model(table):
return cfg return cfg
def to_panelWithUrlSelector(table, selectorTitle='Select', **kwargs): def to_panelWithUrlSelector(
table,
selectorLayout=dict(align='stretch', type='vbox', vertical=True),
selectorPlugins=['pFormToolTip'],
selectorTitle='Select',
**kwargs):
"""Build the configuration of the :class:`.PanelWithUrlSelector` widget. """Build the configuration of the :class:`.PanelWithUrlSelector` widget.
Args: Args:
table (gluon.dal.Table): database table. It is used to build the form table (gluon.dal.Table): database table. It is used to build the form
to select values. The form has one entry per table field. to select values. The form has one entry per table field.
selectorLayout (dict): the layout for the field, by default vbox.
selectorPlugins (list): list of plugins to be used by the selector.
selectorTitle (str): selectorTitle (str):
the title of the FieldSet encapsulating the title of the FieldSet encapsulating
the selector fields. the selector fields.
...@@ -889,16 +896,16 @@ def to_panelWithUrlSelector(table, selectorTitle='Select', **kwargs): ...@@ -889,16 +896,16 @@ def to_panelWithUrlSelector(table, selectorTitle='Select', **kwargs):
if 'baseUrl' not in kwargs: if 'baseUrl' not in kwargs:
raise BaseException('The keyword argument basseUrl is missing.') raise BaseException('The keyword argument basseUrl is missing.')
# build the selector from the table # build the list of fields the table
fields = to_fields(table) fields = to_fields(table)
# configure the selector
selector = FieldSet(items=fields, selector = FieldSet(items=fields,
layout={'align': 'stretch', layout=selectorLayout,
'type':'vbox', plugins=selectorPlugins,
'vertical':True},
plugins=['pFormToolTip'],
title=current.T(selectorTitle)) title=current.T(selectorTitle))
# build the configuration for the PanelWithUrlSelector # configure the PanelWithUrlSelector
default = dict(selectorItems=selector) default = dict(selectorItems=selector)
default.update(kwargs) default.update(kwargs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment