Skip to content
Snippets Groups Projects
Commit b98d29b2 authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Redesign the get_grid method.

parent 2246e6b1
No related branches found
No related tags found
No related merge requests found
......@@ -32,11 +32,13 @@ FTYPE_TO_XTYPE = {'boolean': {'xtype': 'checkbox'},\
# constant defining a store
ROOT = 'records'
STORE_ID = '%sStore'
STOREID = '%sStore'
SUCCESS= 'success'
TOTAL = 'count'
class CfgSvc(BaseSvc):
"""The configuration service which build the configuration options
for the ExtJS widget.
......@@ -468,10 +470,9 @@ class CfgSvc(BaseSvc):
"""
T = self.environment['T']
cfg = {'xtype': 'xentry',
'tableName': tablename,
'tableTitle': str(T(tablename.title())),
'items': self._get_form_items(tablename)}
cfg = {'items': self._get_form_items(tablename),
'store': self.get_jsonstore(tablename),
'xtype': 'xform'}
form_modifiers = self.environment['plugins'].dbui.form_modifiers
if tablename in form_modifiers:
......@@ -496,13 +497,13 @@ class CfgSvc(BaseSvc):
base_params = {'tableName': tablename, 'dbFields': []}
cfg = {'autoLoad': True,
'autoSave': False,
'autoSave': True,
'baseParams': base_params,
'fields': [],
'idProperty': encode_field(tablename,'id'),
'root': ROOT,
'successProperty': SUCCESS,
'storeId': STORE_ID % tablename,
'storeId': STOREID % tablename,
'totalProperty': TOTAL,
'xtype': 'xdirectstore'}
......@@ -557,36 +558,23 @@ class CfgSvc(BaseSvc):
"""
T = self.environment['T']
di = {'xtype': 'grid',
'frame': False,
'viewConfig': {'forceFit': True}}
formModel = {'xtype': 'xform',
'items': self._get_form_items(tablename)}
form_modifiers = self.environment['plugins'].dbui.form_modifiers
if tablename in form_modifiers:
formModel.update(form_modifiers[tablename].extjs)
di['columns'] = self._get_columns_model(tablename)
di['formModel'] = formModel
cfg = {'columns': self._get_columns_model(tablename),
'frame': False,
'formCfg': self.get_form(tablename),
'store': self.get_jsonstore(tablename),
'viewConfig': {'forceFit': True},
'xtype': 'grid'}
filter = self._get_grid_filter(tablename)
if filter:
di['filterModel'] = filter
# di['store'] = STORE_ID % tablename
di['store'] = self.get_jsonstore(tablename)
# di['tableName'] = tablename
di['title'] = T(tablename.title())
cfg['filterModel'] = filter
# handle the user configuration option for Ext.grid.GridPanel
grid_modifiers = self.environment['plugins'].dbui.grid_modifiers
if tablename in grid_modifiers:
di.update(grid_modifiers[tablename].extjs)
cfg.update(grid_modifiers[tablename].extjs)
return di
return cfg
def get_viewport(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment