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):
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.
Args:
table (gluon.dal.Table): database table. It is used to build the form
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):
the title of the FieldSet encapsulating
the selector fields.
......@@ -889,16 +896,16 @@ def to_panelWithUrlSelector(table, selectorTitle='Select', **kwargs):
if 'baseUrl' not in kwargs:
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)
# configure the selector
selector = FieldSet(items=fields,
layout={'align': 'stretch',
'type':'vbox',
'vertical':True},
plugins=['pFormToolTip'],
layout=selectorLayout,
plugins=selectorPlugins,
title=current.T(selectorTitle))
# build the configuration for the PanelWithUrlSelector
# configure the PanelWithUrlSelector
default = dict(selectorItems=selector)
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