| | 1 | = S3GroupedOptionsWidget = |
| | 2 | [[TOC]] |
| | 3 | |
| | 4 | == Python Widget Class == |
| | 5 | |
| | 6 | The {{{S3GroupedOptionsWidget}}} is implemented in {{{/modules/s3/s3widgets.py}}}. |
| | 7 | |
| | 8 | '''The instance of this class receives the widget options''': |
| | 9 | |
| | 10 | {{{#!python |
| | 11 | from s3.s3widgets import S3GroupedOptionsWidget |
| | 12 | |
| | 13 | instance = S3GroupedOptionsWidget(options=None, multiple=True, size=None, cols=None, help_field=None, none=None) |
| | 14 | |
| | 15 | }}} |
| | 16 | |
| | 17 | '''Parameters''': |
| | 18 | |
| | 19 | ||'''Parameter'''||'''Type'''||'''Explanation'''||'''Default'''|| |
| | 20 | ||options||list of tuples [(value, label)], or as dict {value: label}||the options, None to auto-detect the options from the Field during rendering||None|| |
| | 21 | ||multiple||boolean||multiple options can be selected||True|| |
| | 22 | ||size||integer||the maximum number of option in merged letter-groups||12|| |
| | 23 | ||cols||integer||the number of options per row||3|| |
| | 24 | ||help_field||string or dict {value: tooltip-string}||field in the referenced table to retrieve a tooltip text for each option (for foreign keys only), or a dict of tooltips, or a callable returning such a dict||None|| |
| | 25 | ||none||boolean||Render "None" as regular option||False|| |
| | 26 | |
| | 27 | '''To render the HTML for the widget and inject the necessary !JavaScript, call the widget like''': |
| | 28 | |
| | 29 | {{{#!python |
| | 30 | widget = instance(field, value, **attributes) |
| | 31 | }}} |
| | 32 | |
| | 33 | '''Parameters''': |
| | 34 | |
| | 35 | ||'''Parameter'''||'''Type'''||'''Explanation'''||'''Default'''|| |
| | 36 | ||field||Field||the field to select options for ''(required)''||-|| |
| | 37 | ||value|| ||the current value(s) selected ''(required)''||-|| |
| | 38 | ||attributes|| ||HTML-attributes for the widget, e.g. "_class" or "_id"||-|| |
| | 39 | |
| | 40 | == JQuery UI Widget == |
| | 41 | |
| | 42 | The {{{S3GroupedOptionsWidget}}} uses the {{{groupedopts()}}} widget in {{{jquery.ui.groupedopts.js}}}. This jQueryUI-widget-factory based widget renders a normal SELECT element as one or multiple groups of checkboxes: |
| | 43 | |
| | 44 | |
| | 45 | |
| | 46 | ---- |
| | 47 | - [wiki:S3 S3 API Guide] |
| | 48 | - DeveloperGuidelines |