Changes between Version 11 and Version 12 of S3/S3GroupedOptionsWidget
- Timestamp:
- 04/01/13 20:22:38 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
S3/S3GroupedOptionsWidget
v11 v12 17 17 == Python Widget Class == 18 18 19 The {{{S3GroupedOptionsWidget}}} is implemented in {{{/modules/s3/s3widgets.py}}}. 19 The {{{S3GroupedOptionsWidget}}} is implemented in {{{/modules/s3/s3widgets.py}}}. It renders a normal SELECT element (with or without optgroups, depending on the size-parameter): 20 21 {{{#!text/html 22 <select multiple="multiple"> 23 <optgroup label="A - K"> 24 <option value="Ainaro">Ainaro</option> 25 <option value="Dili">Dili</option> 26 <option value="Kuala Lumpur">Kuala Lumpur</option> 27 </optgroup> 28 <optgroup label="L - M"> 29 <option value="Lautém">Lautém</option> 30 <option value="Manatuto">Manatuto</option> 31 <option value="Manufahi">Manufahi</option> 32 </optgroup> 33 <optgroup label="V - Z"> 34 <option value="Viqueque">Viqueque</option> 35 </optgroup> 36 </select> 37 }}} 38 39 ...and then injects a !JavaScript to apply the jQueryUI {{{groupedopts()}}} widget. 40 41 Options can also receive a "title" attribute which is used by {{{groupedopts()}}} to render a hover-tooltip for these options. 20 42 21 43 '''The instance of this class receives the widget options''': … … 33 55 ||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|| 34 56 ||multiple||boolean||multiple options can be selected (False will render radio-buttons instead of checkboxes)||True|| 35 ||size||integer||the maximum number of option in merged letter-groups (None to no group lexicographically)||12||57 ||size||integer||the maximum number of option in merged letter-groups (None to not group by first letter)||12|| 36 58 ||cols||integer||the number of options per row||3|| 37 59 ||help_field||string or dict {value: tooltip-string}||field in the referenced table (if field is a foreign key) to retrieve a tooltip text for each option (to be shown when hovering over the option label), or a dict of tooltips, or a callable returning such a dict||None|| 38 60 ||none||boolean||Render "None" as regular option||False|| 61 62 ''Note'': if there are fewer total options than ''size'', options will not be grouped by first letter at all. 39 63 40 64 '''To render the HTML for the widget and inject the necessary !JavaScript, call the widget like''':