diff --git a/models/widgets_viewport.py b/models/widgets_viewport.py index 8a3967b23dc2a099bd017034dde7d5efbc6c4d0d..1ae80e5ad2c75e62522072a51c7d12ea45b75e3b 100644 --- a/models/widgets_viewport.py +++ b/models/widgets_viewport.py @@ -19,8 +19,18 @@ categoriesLeaf = dbui.Window(closable=True, autoHeight=True, widht=500) +harvestersLeaf = dbui.Window(closable=True, + anchor='100%', + items=[dbui.to_formPanel(db['harvesters'])], + title="Add harvester ...", + defaults={'anchor': '90%'}, + modal=True, + autoHeight=True, + widht=500) + formNode = dbui.Node(T('Forms')) formNode.add_child(T("categories"), categoriesLeaf) +formNode.add_child(T("harvesters"), harvestersLeaf) # # the grid node diff --git a/static/plugin_dbui/locale/dbui-lang-fr.js b/static/plugin_dbui/locale/dbui-lang-fr.js index 8d8ffa3e780756df644a8210fcdc881d291c4280..a3c8a341b90c298c59b3cf3c92954befa1cc2179 100644 --- a/static/plugin_dbui/locale/dbui-lang-fr.js +++ b/static/plugin_dbui/locale/dbui-lang-fr.js @@ -10,6 +10,13 @@ if (App.BasePanelWithSelector) { }); } +if (App.form.field.ComboBox) { + Ext.apply(App.form.field.ComboBox.prototype, { + textSelect: 'Sélectioner un(e) ', + + }); +} + if (App.form.DictField) { Ext.apply(App.form.DictField.prototype, { textAdd: 'Ajouter', diff --git a/static/plugin_dbui/src/combobox.js b/static/plugin_dbui/src/combobox.js index f1484d6db06dd34a0c02aa5b31a029daecde77a7..23bafb542e1295984a9923013ca7f082c80170c7 100644 --- a/static/plugin_dbui/src/combobox.js +++ b/static/plugin_dbui/src/combobox.js @@ -1,18 +1,26 @@ /** - * The ComboBox is an Ext.form.ComboBox linked to an App.data.DirectStore. + * This is Ext.form.field.ComboBox linked to a database table. + * + * The store attribute is equal the table name when the widget + * is configured. It is replaced by an Ext.data.store.Direct + * in the initialization phase of the component. * */ -Ext.define('App.form.ComboBox', { +Ext.define('App.form.field.ComboBox', { - extend: 'Ext.form.ComboBox', + extend: 'Ext.form.field.ComboBox', alias: 'widget.xcombobox', // Predefined setting - mode: 'remote', - editable: false, - selectOnFocus: true, + // Works in auto completion mode when the user type value. + // In any case the value should belongs to the list. + editable: true, + forceSelection: true, + queryMode: 'local', triggerAction: 'all', - typeAhead: true, + + // private properties for internationalization + textSelect: 'Select a ', // private method require by the ExtJs component model initComponent: function () { @@ -21,14 +29,14 @@ Ext.define('App.form.ComboBox', { // defined the empty text from the field label if (this.fieldLabel && !this.emptyText) { - this.emptyText = "Select a " + this.fieldLabel + " ..."; + this.emptyText = this.textSelect + this.fieldLabel + " ..."; } - // link the combobox to the data store + // link the ComboBox to the data store this.store = App.getStore(this.store); - // construct the underlying class. DON'T MOVE - App.form.ComboBox.superclass.initComponent.call(this); + // construct the underlying class. + App.form.field.ComboBox.superclass.initComponent.call(this); // load the store if not yet done if (this.store.getCount() === 0) {