diff --git a/modules/plugin_dbui/cfgsvc.py b/modules/plugin_dbui/cfgsvc.py index 8d31cdce4b1e7fc2513f5a6123e593005e7ffecd..b92e68bdde53738b8def0a640f5d1333b4c74486 100644 --- a/modules/plugin_dbui/cfgsvc.py +++ b/modules/plugin_dbui/cfgsvc.py @@ -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):