コード例 #1
0
ファイル: role.py プロジェクト: dmdm/PySite
 def xhr_browse(self):
     gr = Grid(self.GRID_ID)
     # Need to build the colModel here to initialise the list of allowed
     # fields e.g. for search.
     gr.build_colmodel(self.DD, fieldlist=self.BROWSE_FIELDLIST, opts=self.COLOPTS)
     # Apply request before building the queries. Otherwise
     # build_browse_queries() gets an unitialised grid and sets defaults
     # e.g. for order_field. The settings from the request will then not
     # be applied to the queries.
     gr.apply_request(self.request)
     data_qry, total_qry = self._build_browse_queries(self.request, gr)
     data, total = self._fetch_browse_data(data_qry, total_qry)
     gr.total_rows = total
     resp = gr.get_data_response(data, self.BROWSE_FIELDLIST, self.ID_FIELD)
     return resp