Index: main/plugin-odf-sync/resources/js/org/ametys/odf/sync/widgets/SynchronizedMultiselectField.i18n.js =================================================================== --- main/plugin-odf-sync/resources/js/org/ametys/odf/sync/widgets/SynchronizedMultiselectField.i18n.js (revision 49249) +++ main/plugin-odf-sync/resources/js/org/ametys/odf/sync/widgets/SynchronizedMultiselectField.i18n.js (working copy) @@ -18,7 +18,7 @@ // Register widget org.ametys.utils.Widgets.registerEnumeratedWidget ('string', 'multiselect-synchro', 'org.ametys.odf.sync.widgets.SynchronizedMultiselectField'); -org.ametys.utils.Widgets.registerEnumeratedWidget ('string', 'sorted-multiselect-synchro', 'org.ametys.odf.sync.widgets.SynchronizedMultiselectField'); +org.ametys.utils.Widgets.registerEnumeratedWidget ('string', 'sorted-multiselect-synchro', 'org.ametys.odf.sync.widgets.SynchronizedSortedMultiselectField'); /** * @class This class provides a widget for synchronized text field @@ -38,6 +38,33 @@ config.store = new Ext.data.ArrayStore ({ id: 0, fields: ['value', 'displayText'], + data: enumeratedValues + }) + + config.itemCls = "ametys-input"; + config.labelSeparator = ''; + + org.ametys.odf.sync.widgets.SynchronizedMultiselectField.superclass.constructor.call(this, config); +}; + +/** + * @class This class provides a widget for synchronized text field + * @extends Ext.form.TextField + * @xtype synchrotextfield + */ +org.ametys.odf.sync.widgets.SynchronizedSortedMultiselectField = function(config, enumeratedValues) +{ + if (!config.width) + config.width = 490 - 40; // default width + + config.valueField = 'value'; + config.displayField = 'displayText'; + config.mode = 'local'; + + // The store + config.store = new Ext.data.ArrayStore ({ + id: 0, + fields: ['value', 'displayText'], data: enumeratedValues, sortInfo: {field: 'displayText'} // order }) @@ -77,6 +104,8 @@ xtype: 'synchrotextfield' }); +Ext.extend(org.ametys.odf.sync.widgets.SynchronizedSortedMultiselectField, org.ametys.odf.sync.widgets.SynchronizedMultiselectField); + org.ametys.odf.sync.widgets.SynchronizedMultiselectField.prototype.getBtnConfig = function () { return org.ametys.odf.sync.widgets.SynchronizedWidgetHelper.getBtnConfig (this);