当前位置: 首页>>代码示例>>Python>>正文


Python HiddenWdg.set_persist_on_submit方法代码示例

本文整理汇总了Python中pyasm.widget.HiddenWdg.set_persist_on_submit方法的典型用法代码示例。如果您正苦于以下问题:Python HiddenWdg.set_persist_on_submit方法的具体用法?Python HiddenWdg.set_persist_on_submit怎么用?Python HiddenWdg.set_persist_on_submit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasm.widget.HiddenWdg的用法示例。


在下文中一共展示了HiddenWdg.set_persist_on_submit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SearchLimitWdg

# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_persist_on_submit [as 别名]
class SearchLimitWdg(Widget):
    DETAIL = "detail_style"
    LESS_DETAIL = "less_detail_style"
    SIMPLE = "simple_style"

    def __init__(self, name='search_limit', label="Showing", limit=None, refresh=True):

        self.search_limit_name = name
        self.label = label
        if limit:
            self.search_limit = int(limit)
        else:
            self.search_limit = None
        self.fixed_offset = False
        self.style = self.DETAIL
        self.prefix = "search_limit"
        self.refresh = refresh
        self.refresh_script = 'spt.dg_table.search_cbk(evt, bvr)'
        if self.refresh:
            self.prev_hidden_name = 'Prev'
            self.next_hidden_name = 'Next'
        else:
            self.prev_hidden_name = '%s_Prev' %self.label
            self.next_hidden_name = '%s_Next' %self.label


        self.chunk_size = 0
        self.chunk_num = 0

        super(SearchLimitWdg, self).__init__()
        
    def init(self):
        self.current_offset = 0
        self.count = None
        #self.text = TextWdg(self.search_limit_name)
        self.text = HiddenWdg(self.search_limit_name)
        self.text.add_style("width: 23px")
        self.text.add_style("margin-bottom: -1px")
        self.text.add_class("spt_search_limit_text")
        self.text.set_persist_on_submit(prefix=self.prefix)

        behavior = {
                'type': 'keydown',
                'cbjs_action': '''
                 if (evt.key=='enter') {
                    // register this as changed item
                    var value = bvr.src_el.value;
                    
                        if (isNaN(value) || value.test(/[\.-]/)) {
                            spt.error('You have to use an integer.');
                        }
                }
        '''}

        self.text.add_behavior(behavior)

        # get the search limit that is passed in
        filter_data = FilterData.get()
        values = filter_data.get_values_by_prefix(self.prefix)
        if not values:
            # check web for embedded table
            web = WebContainer.get_web()
            values = {}
            limit_value = web.get_form_value("search_limit")
            label_value = web.get_form_value(self.label)
            if limit_value:
                values['search_limit'] = limit_value
            if label_value:
                values[self.label] = label_value
        else:
            values = values[0]


        self.values2 = filter_data.get_values_by_prefix("search_limit_simple")
        if not len(self.values2):
            self.values2 = {}
        elif len(self.values2) == 2:
            if self.values2[0]['page']:
                self.values2 = self.values2[0]
            else:
                self.values2 = self.values2[1]
        else:
            self.values2 = self.values2[0]


        self.stated_search_limit = values.get("search_limit")
        """
        if not self.stated_search_limit:
            self.stated_search_limit = values.get("limit_select")
        if not self.stated_search_limit:
            self.stated_search_limit = values.get("custom_limit")
        """
        if self.stated_search_limit:
            self.stated_search_limit = int(self.stated_search_limit)
        else:
            self.stated_search_limit = 0
      
        # reused for alter_search() later
        self.values = values
       
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:search_limit_wdg.py


注:本文中的pyasm.widget.HiddenWdg.set_persist_on_submit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。