[pbs-devel] [PATCH v2 widget-toolkit] form: display-edit: support emptyText
Fiona Ebner
f.ebner at proxmox.com
Tue Nov 26 17:25:15 CET 2024
Am 26.11.24 um 17:20 schrieb Fiona Ebner:
> To access the edit field, its xtype is now tracked.
>
> First user is intended to be the path field for datastores where the
> emptyText should dynamically be for a relative or absolute path.
>
> Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
> ---
>
> Changes in v2:
> * avoid tracking emptyText state twice, pass directly to edit field.
>
> src/form/DisplayEdit.js | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/src/form/DisplayEdit.js b/src/form/DisplayEdit.js
> index fe1b83b..01d6a05 100644
> --- a/src/form/DisplayEdit.js
> +++ b/src/form/DisplayEdit.js
> @@ -12,6 +12,9 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
>
> displayType: 'displayfield',
>
> + // internal only, use editConfig to set the xtype
> + _editType: 'textfield',
> +
> editConfig: {},
> editable: false,
> setEditable: function(editable) {
> @@ -41,6 +44,15 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
> vm.get('value');
> },
>
> + setEmptyText: function(emptyText) {
> + let me = this;
> + me.down(me._editType).setEmptyText(emptyText);
> + },
> + getEmptyText: function() {
> + let me = this;
> + return me.down(me._editType).getEmptyText();
> + },
> +
> layout: 'fit',
> defaults: {
> hideLabel: true,
> @@ -64,6 +76,8 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
> });
> Ext.applyIf(editConfig, displayConfig);
>
> + me.__editType = editConfig.xtype;
Sorry, there is a typo here, __editType instead of _editType
> +
> if (me.initialConfig && me.initialConfig.displayConfig) {
> Ext.applyIf(displayConfig, me.initialConfig.displayConfig);
> delete displayConfig.displayConfig;
More information about the pbs-devel
mailing list