本文整理汇总了Python中pyasm.widget.TableWdg.do_search方法的典型用法代码示例。如果您正苦于以下问题:Python TableWdg.do_search方法的具体用法?Python TableWdg.do_search怎么用?Python TableWdg.do_search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.TableWdg
的用法示例。
在下文中一共展示了TableWdg.do_search方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.widget import TableWdg [as 别名]
# 或者: from pyasm.widget.TableWdg import do_search [as 别名]
def get_display(self):
web = WebContainer.get_web()
args = web.get_form_args()
# get the args in the URL
search_type = args['search_type']
search_id = args['search_id']
sobject = Search.get_by_search_key("%s|%s" % (search_type,search_id) )
planner_search_type = self.get_search_type()
# get parent instances first
'''
all_instances = []
parent_code = ""
if sobject.has_value("parent_code"):
parent_code = sobject.get_value("parent_code")
if parent_code != "":
parent = sobject.get_by_code(parent_code)
search = Search(planner_search_type)
search.add_filter(sobject.get_foreign_key(), parent.get_code())
instances = search.get_sobjects()
all_instances.extend(instances)
'''
search = Search(planner_search_type)
search.add_filter(sobject.get_foreign_key(), sobject.get_code())
instances = search.get_sobjects()
#all_instances.extend(instances)
widget = DivWdg()
widget.add( HiddenWdg("planner_search_type", planner_search_type) )
widget.add_style("width: 95%")
widget.add_style("float: right")
table = TableWdg(search_type, "layout", css='minimal')
table.table.set_max_width(use_css=True)
#table.set_sobjects(all_instances)
table.set_search(search)
table.do_search()
table.set_show_property(False)
#aux_data = ShotInstance.get_aux_data(all_instances)
#table.set_aux_data(aux_data)
widget.add(table)
return widget
示例2: get_display
# 需要导入模块: from pyasm.widget import TableWdg [as 别名]
# 或者: from pyasm.widget.TableWdg import do_search [as 别名]
def get_display(my):
search_type = my.options.get("search_type")
view = my.options.get("view")
filter = my.options.get("filter")
if type(filter) in types.StringTypes:
filters = [filter]
elif not filter:
filters = []
else:
filters = filter
# create the search
search = Search(search_type)
widget = Widget()
div = DivWdg(css="filter_box")
widget.add(div)
for i, filter in enumerate(filters):
if filter.find("|") != -1:
filter_name, expression = filter.split("|", 1)
else:
filter_name = filter
expression = None
span = SpanWdg(css="med")
filter_wdg = Container.get_dict("widgets", filter_name)
if not filter_wdg:
filter_wdg = Common.create_from_class_path(filter_name)
span.add(filter_wdg)
div.add(span)
else:
span.add("%s: " % filter_wdg.get_name())
if expression:
name = filter_wdg.get_name()
value = filter_wdg.get_value()
if value != "":
expression = expression.replace("{name}", name)
expression = expression.replace("{value}", value)
search.add_where(expression)
else:
filter_wdg.alter_search(search)
filter_wdg.set_name(filter_name)
span = SpanWdg(css="med")
span.add("%s: " % filter_name)
span.add(filter_wdg)
div.add(span)
table = TableWdg(search_type, view)
table.set_search(search)
table.do_search()
widget.add(table)
return widget