Modules
- tw2.bootstrap
- tw2.bootstrap.forms
- tw2.captcha
- tw2.core
- tw2.d3
- tw2.dynforms
- tw2.dyntext
- tw2.etc
- tw2.excanvas
- tw2.forms
- tw2.jit
- tw2.jqplugins.chosen
- tw2.jqplugins.cookies
- tw2.jqplugins.dynatree
- tw2.jqplugins.fg
- tw2.jqplugins.flot
- tw2.jqplugins.fullcalendar
- tw2.jqplugins.jqgrid
- tw2.jqplugins.jqplot
- tw2.jqplugins.portlets
- tw2.jqplugins.select2
- tw2.jqplugins.ui
- tw2.jquery
- tw2.lesscss
- tw2.polymaps
- tw2.protovis.conventional
- tw2.protovis.core
- tw2.protovis.custom
- tw2.protovis.hierarchies
- tw2.qrcode
- tw2.rrd
- tw2.slideymenu
- tw2.sqla
- tw2.tinymce
- tw2.tipster
- tw2.util.html5shim
- tw2.wysihtml5
tw2.jqplugins.chosen
Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly.
For more information about Chosen, see: http://harvesthq.github.com/chosen/
chosen_img
- location
- Location on the page where the resource should be placed.This can be one of: head, headbottom, bodytop or bodybottom. None means the resource will not be injected, which is still useful, e.g. static images.
- modname
- Name of Python module that contains the file.
- filename
- Path to file, relative to module base.
- no_inject
- Don't inject this link. (Default: False)
- whole_dir
- Make the whole directory available. (Default: False)
chosen_js
- location
- Location on the page where the resource should be placed.This can be one of: head, headbottom, bodytop or bodybottom. None means the resource will not be injected, which is still useful, e.g. static images.
- modname
- Name of Python module that contains the file.
- filename
- Path to file, relative to module base.
- no_inject
- Don't inject this link. (Default: False)
- whole_dir
- Make the whole directory available. (Default: False)
chosen_css
- location
- Location on the page where the resource should be placed.This can be one of: head, headbottom, bodytop or bodybottom. None means the resource will not be injected, which is still useful, e.g. static images.
- modname
- Name of Python module that contains the file.
- filename
- Path to file, relative to module base.
- no_inject
- Don't inject this link. (Default: False)
- whole_dir
- Make the whole directory available. (Default: False)
- media
- Media tag
ChosenSingleSelectField
SingleSelectField, enhanced with Chosen javascript
- prompt_text
- Text to prompt user to select an option.
- placeholder
- Placeholder text, prompting user for selection
- no_results_text
- Text shown when the search term returned no results
class DemoChosenSingleSelectField(ChosenSingleSelectField):
options = [('Group 1', ['Item 1', 'Item 2']),
('Group 2', ['Item 3', 'Item 4', 'Item 5', 'Item 6'])]
value = 'Item 2'
attrs = dict(style='width: 200px')
<%namespace name="tw" module="tw2.core.mako_util"/>\
<select ${tw.attrs(attrs=w.attrs)}>
% for group, options in w.grouped_options:
% if group:
<optgroup ${tw.attrs(attrs=dict(label=group))}>
% endif
% for attrs, desc in options:
<option ${tw.attrs(attrs=attrs)}>${desc}</option>
% endfor
% if group:
</optgroup>
% endif
% endfor
</select>
ChosenMultipleSelectField
MultipleSelectField, enhanced with Chosen javascript
- prompt_text
- Text to prompt user to select an option.
- item_validator
- Validator that applies to each item
- size
- Number of visible options
- placeholder
- Placeholder text, prompting user for selection
- no_results_text
- Text shown when the search term returned no results
class DemoChosenMultipleSelectField(ChosenMultipleSelectField):
options = [('Group 1', ['Item 1', 'Item 2']),
('Group 2', ['Item 3', 'Item 4', 'Item 5', 'Item 6'])]
#value = ['Item 2', 'Item 5']
placeholder = 'Select an item, you won\'t regret it'
attrs = dict(style='width: 400px')
<%namespace name="tw" module="tw2.core.mako_util"/>\
<select ${tw.attrs(attrs=w.attrs)}>
% for group, options in w.grouped_options:
% if group:
<optgroup ${tw.attrs(attrs=dict(label=group))}>
% endif
% for attrs, desc in options:
<option ${tw.attrs(attrs=attrs)}>${desc}</option>
% endfor
% if group:
</optgroup>
% endif
% endfor
</select>