1. #1
    Sencha User naveedanjum's Avatar
    Join Date
    Feb 2010
    Location
    Islamabad, Pakistan
    Posts
    21
    Answers
    1
    Vote Rating
    0
    naveedanjum is on a distinguished road

      0  

    Question Unanswered: How to convert Ext JS 3 based ImageField to Ext JS 4

    Unanswered: How to convert Ext JS 3 based ImageField to Ext JS 4


    Code:
    Ext.form.ImageField = Ext.extend(Ext.form.Field, {
         autoCreate: {tag: 'img'}
         ,setValue: function(new_value){
             if (new_value == undefined || new_value == null) {
                 this.el.dom.src = '/images/no_image.png';
             } else {
                 this.el.dom.src = '/images/thumbnail/' + new_value;
             }
         }
         ,initValue : function(){
             this.setValue(this.value);
         }
         ,initComponent: function() {
             Ext.apply(this, {
             });
             Ext.form.ImageField.superclass.initComponent.apply(this);
         }
    });
    Ext.reg('image_field', Ext.form.ImageField);
    Any Idea?? whats alternative in Ext JS 4
    Last edited by skirtle; 9 Dec 2011 at 4:06 AM. Reason: Add newlines to make code legible
    Farrukh Naveed Anjum
    Team Lead (Software Engineer)

  2. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,108
    Answers
    83
    Vote Rating
    31
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    Use Ext.define and give it an alias property.

    See http://docs.sencha.com/ext-js/4-0/#!/guide/class_system

  3. #3
    Sencha User naveedanjum's Avatar
    Join Date
    Feb 2010
    Location
    Islamabad, Pakistan
    Posts
    21
    Answers
    1
    Vote Rating
    0
    naveedanjum is on a distinguished road

      0  

    Default


    Hello there, I converted this to Ext JS 4 notation but i am getting a.getItemId is not a function on following code.

    Code:
    Ext.define('sample.ui.ImageField',{
        extend : 'Ext.form.field.Field',
        alias : 'widget.imageField',
        
        autoCreate: {tag: 'img'},
        
        constructor:function(config) 
        {
            return this.callParent(arguments);
        },
    
        initComponent:function() 
        {
            sample.ui.ImageField.superclass.initComponent.apply( this, arguments );
        },
        
        onRender:function() 
        {
            sample.ui.ImageField.superclass.onRender.apply( this, arguments );
        },
        
        setValue: function(new_value){
            if (new_value == undefined || new_value == null) {
                this.el.dom.src = '/images/no_image.png';
            } else {
                this.el.dom.src = '/images/thumbnail/' + new_value;
            }
        },
        
        initValue : function(){
            this.setValue(this.value);
        }
    
    });
    Farrukh Naveed Anjum
    Team Lead (Software Engineer)

  4. #4
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,663
    Answers
    130
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    you really need to get familiar with the basics of the new ext 4 syntax.

    do you know what this.callParent(arguments); is meant for?

    you can remove your constructor method completely.

    Code:
    return this.callParent(arguments);
    makes no sense and can cause an error.

    inside your other methods like initComponent:
    Code:
    sample.ui.ImageField.superclass.initComponent.apply( this, arguments );
    can get replaced with:
    Code:
    this.callParent(arguments);
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar