1. #1
    Ext User
    Join Date
    Jan 2010
    Posts
    4
    Vote Rating
    0
    utpal_brsh is on a distinguished road

      0  

    Default ERROR in Getting Value From Custom Xtype

    ERROR in Getting Value From Custom Xtype


    Hi
    I created a xtype to use in my form like following.Here I combined two numberfield and I also create an function two get these two value together.

    appdatetime=Ext.extend(Ext.Panel,{
    initComponent: function() {
    Ext.apply(this, {
    width: 70,
    frame: false,
    border: false,
    items:[{
    id:'definedTimeInDate',
    name:'definedTimeInDate',
    xtype:'numberfield',
    width:40,
    height:20,
    maxLength:3,
    minLenght:3
    },{
    id:'definedTimeInHours',
    name:'definedTimeDateInHours',
    xtype:'numberfield',
    width:30,
    height:20,
    maxLength:2 ,
    minLenght:2
    }
    ]
    });
    appdatetime.superclass.initComponent.call(this);
    },
    getDefinedTermValue:function(){
    return Ext.getCmp('definedTimeDateId').getValue()+""+Ext.getCmp('definedTimeDateHours').getValue();
    }
    });
    Ext.reg('appdatetime',appdatetime);

    In my form I use this xtype using the following code
    {
    id:'defined_term_id',
    name:'defined_term_id',
    xtype:'appdatetime'
    }

    Now while i try to get these two value using Ext.getCmp('defined_term_id').getDefinedTermValue() i m getting BLANK ..Please tell me where is the mistake?? and How to solve this??

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    83
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    I don't see any reason why this shouldn't work.

    ps. Why are you creating a custom component if you are only planning on using it once? If you want a reusable component then you shouldn't be using global ids, e.g.
    Code:
    Ext.ns('MyNamespace');
    MyNamespace.appdatetime = Ext.extend(Ext.Panel, {
        initComponent: function () {
            this.definedTimeInDate = new Ext.form.NumberField({
                name: 'definedTimeInDate',
                width: 40,
                height: 20,
                maxLength: 3,
                minLenght: 3
            });
            this.definedTimeInHours = new Ext.form.NumberField({
                name: 'definedTimeInHours',
                width: 30,
                height: 20,
                maxLength: 3,
                minLenght: 3
            });
            Ext.apply(this, {
                width: 70,
                frame: false,
                border: false,
                items: [this.definedTimeInDate, this.definedTimeInHours]
            });
            MyNamespace.appdatetime.superclass.initComponent.call(this);
        },
        getDefinedTermValue: function () {
            return this.definedTimeInDate + '' + this.definedTimeInHours;
        }
    });
    Ext.reg('appdatetime', MyNamespace.appdatetime);

Similar Threads

  1. Portal + Custom Grids by XType
    By KimSchneider in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 9 Feb 2010, 1:43 AM
  2. twintrigger error: b[d.xtype || e] is not a constructor
    By nathanblogs in forum Ext 3.x: Help & Discussion
    Replies: 8
    Last Post: 22 Nov 2009, 7:14 AM
  3. difference between xtype and custom class... why??
    By tarini in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 21 Jan 2009, 5:13 AM
  4. FormPanel - custom xtype ???
    By archmisha in forum Ext 2.x: Help & Discussion
    Replies: 9
    Last Post: 20 Oct 2008, 9:18 AM

Thread Participants: 1

Tags for this Thread