sencha-touchsencha-touch-2sencha-touch-2.2

Extending Sencha Touch Text Field


I am trying to extend the TextField to initialize the value based on the location information. The following code does what i need.

Ext.define("Tasks.view.LatitudeField", {
    extend: 'Ext.field.Text',
    alias:'widget.latitudeField',

    xtype: 'latitudefield',  

    initialize : function() 
    {
        console.log("Component Initialized ");
        this.setValue("123456");
    },
});

But when the field is displayed, I can't click on the x icon to clear the text. The x icon is not clickable at all.

enter image description here


Solution

  • Call the parent method in your initialize method:

    initialize: function() {
        console.log("Component Initialized ");
        this.setValue("123456");
    
        this.callParent(arguments);
    }