Results 1 to 8 of 8

Thread: [7.0.0] material design field label error

  1. #1
    Sencha User
    Join Date
    Mar 2010
    Location
    Ukraine
    Posts
    54

    Default [7.0.0] material design field label error

    when text field contain listeners config, label return back to field with content, but it wrong

  2. #2
    Sencha User
    Join Date
    Mar 2010
    Location
    Ukraine
    Posts
    54

    Default

    Look at label in material theme:
    {
    xtype: 'textfield',
    fieldLabel: 'Some field',
    value: 'type text',
    listeners : {
    }
    }

  3. #3
    Sencha Premium User
    Join Date
    Feb 2010
    Posts
    4

    Default

    Quote Originally Posted by sebbio View Post
    Look at label in material theme:
    {
    xtype: 'textfield',
    fieldLabel: 'Some field',
    value: 'type text',
    listeners : {
    }
    }
    See https://fiddle.sencha.com/#view/editor&fiddle/3248 with your problem

  4. #4
    Sencha User
    Join Date
    Jan 2016
    Location
    Brazil
    Posts
    141

    Default

    You can just
    Code:
    [FIDDLE ]3248[/FIDDLE]
    to embed your fiddle here.

    Object.NET
    Frameworks and Tools for .NET Developers
    --------------------------------------------------
    Ext.NET - Ext JS for ASP.NET - Examples | Twitter
    Bridge.NET - Write C#. Run JavaScript! - Live | Twitter
    --------------------------------------------------

  5. #5

    Join Date
    Jan 2008
    Location
    Levittown, PA
    Posts
    362

    Default

    Is there any fix for this bug?

  6. #6
    Sencha Premium User
    Join Date
    Feb 2010
    Posts
    4

    Default

    No, but a workaround.You can add a listener to textfield or combobox in the init code of the view controller.
    Code:
     init: function (view) {                var combo = view.down("#yourComboBox"); // works also for textfield                combo.addListener({                          change: function (combobox, newValue, oldValue, eOpts) {               // your code                          }                });     }
    This prevent this strange behavior

  7. #7

    Join Date
    Jan 2008
    Location
    Levittown, PA
    Posts
    362

    Default

    That's awesome there is a workaround for such a basic and core piece of the new 7.0 major release.

  8. #8
    Sencha Premium User
    Join Date
    Mar 2017
    Posts
    27

    Default

    Hi, the problem is here :

    PHP Code:
    Ext.define('Ext.theme.material.form.field.Text', {    
        
    override'Ext.form.field.Text',
        
    labelSeparator'',
        
    listeners: {
            
    change: function(fieldvalue) {
                if (
    field.el) {
                    
    field.el.toggleCls('not-empty'value || field.emptyText);
                }
            },
            
    render: function(thswidthheighteOpts) {
                if ((
    ths.getValue() || ths.emptyText) && ths.el) {
                    
    ths.el.addCls('not-empty');
                }
            }
        }
    }); 
    When you override the listeners config, change & render events are not fired, and the 'not-empty' cls is not added to field

    Maybe something like :
    PHP Code:
    Ext.define('Ext.theme.material.form.field.Text', {
      
    override 'Ext.form.field.Text',
      
    labelSeparator '',
      
    listeners:{},
      
    initComponent : function () {
        
    this.callParent();
        
    this.on({
          
    change : function (fieldvalue) {
            if (
    field.el) {
                
    field.el.toggleCls('not-empty'value || field.emptyText);
            }
          },
          
    render : function (thswidthheighteOpts) {
            if ((
    ths.getValue() || ths.emptyText) && ths.el) {
                
    ths.el.addCls('not-empty');
            }
          },
          
    scope this
        
    });
      }
    }); 
    would work

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •