Changes between Version 11 and Version 12 of S3/S3GroupedOptionsWidget

04/01/13 20:22:38 (11 years ago)
Dominic König



  • S3/S3GroupedOptionsWidget

    v11 v12  
    1717== Python Widget Class ==
    19 The {{{S3GroupedOptionsWidget}}} is implemented in {{{/modules/s3/}}}.
     19The {{{S3GroupedOptionsWidget}}} is implemented in {{{/modules/s3/}}}. It renders a normal SELECT element (with or without optgroups, depending on the size-parameter):
     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>
     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>
     33<optgroup label="V - Z">
     34<option value="Viqueque">Viqueque</option>
     39...and then injects a !JavaScript to apply the jQueryUI {{{groupedopts()}}} widget.
     41Options can also receive a "title" attribute which is used by {{{groupedopts()}}} to render a hover-tooltip for these options.
    2143'''The instance of this class receives the widget options''':
    3355  ||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||
    3456  ||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||
    3658  ||cols||integer||the number of options per row||3||
    3759  ||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||
    3860  ||none||boolean||Render "None" as regular option||False||
     62  ''Note'': if there are fewer total options than ''size'', options will not be grouped by first letter at all.
    4064'''To render the HTML for the widget and inject the necessary !JavaScript, call the widget like''':