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

Several modification.

Rename get_json_store → get_jsonstore.
Add some protection.
For the time being the grid use a complete configuration for a store not only it id string.
parent e22d4bde
No related branches found
No related tags found
No related merge requests found
......@@ -333,6 +333,9 @@ class CfgSvc(BaseSvc):
db = self.environment['db']
grid_modifiers = self.environment['plugins'].dbui.grid_modifiers
if tablename not in grid_modifiers:
return {}
grid_filters = grid_modifiers[tablename].grid_filters
if not grid_filters:
return {}
......@@ -477,7 +480,7 @@ class CfgSvc(BaseSvc):
return cfg
def get_json_store(self, tablename):
def get_jsonstore(self, tablename):
"""Build the configuration object for the Ext.data.DirectJsonStore
associated to the database table tablename.
......@@ -492,14 +495,16 @@ class CfgSvc(BaseSvc):
# where: define inner join, mainly to resolve foreign key
base_params = {'tableName': tablename, 'dbFields': []}
cfg = {'autoSave': False,
cfg = {'autoLoad': True,
'autoSave': False,
'baseParams': base_params,
'fields': [],
'idProperty': encode_field(tablename,'id'),
'root': ROOT,
'successProperty': SUCCESS,
'storeId': STORE_ID % tablename,
'totalProperty': TOTAL}
'totalProperty': TOTAL,
'xtype': 'xdirectstore'}
for fieldname in db[tablename].fields:
......@@ -552,7 +557,9 @@ class CfgSvc(BaseSvc):
"""
T = self.environment['T']
di = {'xtype': 'grid'}
di = {'xtype': 'grid',
'frame': False,
'viewConfig': {'forceFit': True}}
formModel = {'xtype': 'xform',
'items': self._get_form_items(tablename)}
......@@ -568,8 +575,9 @@ class CfgSvc(BaseSvc):
if filter:
di['filterModel'] = filter
di['store'] = STORE_ID % tablename
di['tableName'] = tablename
# di['store'] = STORE_ID % tablename
di['store'] = self.get_jsonstore(tablename)
# di['tableName'] = tablename
di['title'] = T(tablename.title())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment