def ajax_html_select(name_title_html, **kwargs): '''If no htmlid is provided, a new widget containing the target html is created and data is an iterable over three elements tuples.''' htmlid = gen_unique_id()[:8] target = Widget('div', id=htmlid) select = Widget('select', cn = 'text-select')\ .addData('target','#{0}'.format(htmlid)) for name, title, body in name_title_html: select.add((name, title)) target.add(Widget('div', body, cn='{0} target'.format(name))) return Widget(None, (select, target))
def ajax_html_select(name_title_html, **kwargs): '''If no htmlid is provided, a new widget containing the target html is created and data is an iterable over three elements tuples.''' htmlid = gen_unique_id()[:8] target = Widget('div',id=htmlid) select = Widget('select', cn = 'text-select')\ .addData('target','#{0}'.format(htmlid)) for name,title,body in name_title_html: select.add((name,title)) target.add(Widget('div', body, cn = '{0} target'.format(name))) return Widget(None,(select,target))
def _unwind(self): if self._data_stream: ul = Widget('ul').addClass(self.internal.get('type')) divs = [] for key, val in self._data_stream: if not isinstance(key, Widget) or key.tag != 'a': id = gen_unique_id()[:8] key = Widget('a', key, href='#' + id) divs.append(Widget('div', val, id=id)) ul.add(Widget('li', key, cn=classes.clickable)) yield ul for div in divs: yield div
def _unwind(self): if self._data_stream: ul = Widget('ul').addClass(self.internal.get('type')) divs = [] for key, val in self._data_stream: if not isinstance(key,Widget) or key.tag!='a': id = gen_unique_id()[:8] key = Widget('a', key, href='#'+id) divs.append(Widget('div', val, id=id)) ul.add(Widget('li', key, cn=classes.clickable)) yield ul for div in divs: yield div