def context(self): m_HeadDic = self.grid.HeadDic() m_init_option = { "url":"/grid/%s/%s/"%(self.app_menu,self.__class__.__name__), "dataType":"json", "usepager": True, "useRp": True, "rp": 15, "showTableToggleBtn":True, "onToggleCol":'$do_ToggleCol$', "onSubmit":'$do_Submit$', "pagestat":'显示 {from} 到 {to} ,共 {total} 条记录', 'nomsg':'无记录', 'procmsg':'正在处理中...', 'pagetext':'第', 'outof': '页 / 共', 'findtext': '查找' } m_init_option.update(self.option) m_HeadDic.update(m_init_option) addition = {"grid_option":smart_str(json_dumps(m_HeadDic)).replace('"$','').replace('$"','')} addition["hide_list"] = self.hide_list if self.search_form: ''' 查询表单的处理 ''' import forms form=forms.Form() for e in self.search_form: field = e[1] form.fields[e[0]]=field addition["search_form"] = form addition.update(self.m_context) return addition
def GridView(request,grid_model,**arg): m_grid = grid_model.grid grid_model.SetPageSize(arg['psize']) grid_model.MakeData(request,**arg) grid_model.grid.ParseArg(**arg) if not grid_model._paged: grid_model.Paging(arg['offset']) ret = m_grid.ResultDic() return smart_str(json_dumps(ret))
def context(self): m_HeadDic = self.grid.HeadDic() app_label = self.app_menu model_name = self.__class__.__name__ m_init_option = { "url":"/grid/%s/%s/"%(app_label, model_name), "dataType":"json", "usepager": True, "useRp": True, "rp": 15, "showTableToggleBtn":True, "onToggleCol":'$do_ToggleCol$', "onSubmit":'$do_Submit$', "pagestat":'显示 {from} 到 {to} ,共 {total} 条记录', 'nomsg':'无记录', 'procmsg':'正在处理中...', 'pagetext':'第', 'outof': '页 / 共', 'findtext': '查找' } m_init_option.update(self.option) if self.__class__._firstrun: from load import FORM_ACTIONS if FORM_ACTIONS.has_key(app_label): if FORM_ACTIONS[app_label].has_key(model_name): m_form_actions = FORM_ACTIONS[app_label][model_name] if len(m_form_actions)>0: if m_init_option.has_key("buttons"): tar = m_init_option["buttons"] else: m_init_option["buttons"]=[] tar = m_init_option["buttons"] for e in m_form_actions: tar.append( {"name": e[1].verbose_name, "bclass": e[1].icon, "onpress" : "$%s$"%e[0]} ) self.__class__._firstrun=False m_HeadDic.update(m_init_option) addition = {"grid_option":smart_str(json_dumps(m_HeadDic)).replace('"$','').replace('$"','')} addition["hide_list"] = self.hide_list if self.search_form: ''' 查询表单的处理 ''' import forms form=forms.Form() for e in self.search_form: field = e[1] form.fields[e[0]]=field addition["search_form"] = form addition.update(self.m_context) return addition