Modules
- 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.dyntext
DynamicTextWidget
- initial_text
- Initial text to place in the widget. Default: None
- wrap
- Tag to wrap the widget with. Default: span
class DemoDynamicTextWidget(widgets.DynamicTextWidget):
initial_value = "I don't really do anything unless you call setDynamicText()."
<%namespace name="tw" module="tw2.core.mako_util"/>
<${w.wrap} id="${w.attrs['id']}">${w.initial_text}</${w.wrap}>
PollingDynamicTextWidget
- initial_text
- Initial text to place in the widget. Default: None
- wrap
- Tag to wrap the widget with. Default: span
- data_url
- (str) URL where JSON data should be pulled from
- interval
- (int) Polling interval in milliseconds
class DemoPollingDynamicTextWidget(widgets.PollingDynamicTextWidget):
# Provide default parameters, value, etc... here
# default = <some-default-value>
data_url = '/dynamic_text_demo'
@classmethod
def request(cls, req):
lottery_numbers = ", ".join([str(random.randint(1,100)) for x in range(5)])
resp = webob.Response(request=req, content_type="application/json")
resp.body = json.dumps({'text': lottery_numbers})
return resp
<%namespace name="tw" module="tw2.core.mako_util"/>
<${w.wrap} id="${w.attrs['id']}">${w.initial_text}</${w.wrap}>