1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    26
    Answers
    2
    Vote Rating
    0
    squistbe is on a distinguished road

      0  

    Default Answered: Why doesn't Sencha Touch 2 have an xtype displayfield?

    Answered: Why doesn't Sencha Touch 2 have an xtype displayfield?


    If you look in Ext documentation there is an xtype displayfield, but not in Sencha Touch. Is there is a replacement for displayfield in Sencha Touch2?

  2. Having a container is valid, no reason to always need to use a form field within a form.

  3. #2
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,132
    Answers
    128
    Vote Rating
    97
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    There are other things that are in Ext JS but not in Sencha Touch. Couldn't you just use a container or dataview to do the same thing?

  4. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    26
    Answers
    2
    Vote Rating
    0
    squistbe is on a distinguished road

      0  

    Default


    I am inside a form panel and all my form fields are wrapped in a fieldset. I was hoping to use a form field. I believe the displayfield in Ext is just text in a div. I would like to do something similar.

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,668
    Answers
    3354
    Vote Rating
    746
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Having a container is valid, no reason to always need to use a form field within a form.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Answers
    4
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default


    Easy to write your own. Add a little CSS and you're done.

    Code:
    Ext.define('My.view.DisplayField', {
        
        extend: 'Ext.field.Field',
        xtype: 'displayField',
        
        config: {
            displayText: null,
            component: {
                xtype: 'displayFieldComponent'
            }
        },
        
    
    
        initialize: function() {
            var me = this,
                comp = me.getComponent();
            
            me.callParent();
        },
        
        updateDisplayText: function(value) {
            var me = this,
                comp = me.getComponent();
                
            comp.displayElement.setHtml(value);
        }
        
    });
    
    
    Ext.define('My.view.DisplayFieldComponent', {
        
        extend: 'Ext.Component',
        xtype: 'displayFieldComponent',
        
        config: {
            cls: 'x-field-input'
        },
        
        getTemplate: function() {
            return [{
                reference: 'displayElement',
                tag: 'div'
            }]
        }
        
    });
    
    
    Ext.create('Ext.form.Panel', {
        fullscreen: true,
        items: [
            {
                xtype: 'fieldset',
                title: 'Enter your name',
                items: [
                    {
                        xtype: 'textfield',
                        label: 'First Name',
                        name: 'firstName'
                    },
                    {
                        xtype: 'textfield',
                        label: 'Last Name',
                        name: 'lastName'
                    },
                    {
                        xtype: 'displayField',
                        label: 'Display Only',
                        displayText: 'Can\'t touch this'
                    }
                ]
            }
        ]
    });

  7. #6
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    St Louis,MO
    Posts
    267
    Answers
    20
    Vote Rating
    18
    James Goddard will become famous soon enough James Goddard will become famous soon enough

      0  

    Default


    Quote Originally Posted by squistbe View Post
    If you look in Ext documentation there is an xtype displayfield, but not in Sencha Touch. Is there is a replacement for displayfield in Sencha Touch2?
    Sencha Touch contains a very small subset of Ext.

  8. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    26
    Answers
    2
    Vote Rating
    0
    squistbe is on a distinguished road

      0  

    Default


    I tried writing my own, but I get the Cannot create an instance of unrecognized alias: widget.displayFieldComponent ​error.

  9. #8
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Answers
    4
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default


    Did you include both classes?

  10. #9
    Sencha User
    Join Date
    Jul 2012
    Posts
    26
    Answers
    2
    Vote Rating
    0
    squistbe is on a distinguished road

      0  

    Default


    I included 'MyApp.view.DisplayField'. What other class are you referring to?

  11. #10
    Sencha User
    Join Date
    May 2007
    Posts
    24
    Vote Rating
    1
    gigel is on a distinguished road

      0  

    Default


    Thanks "estesbubba" for your code. Here's my slightly improved version:

    Code:
    Ext.define('My.view.DisplayField', {
    	extend: 'Ext.field.Field', xtype: 'displayField',
    	config: {component: {xtype: 'displayFieldComponent'}},
    	setValue: function(value) {this.getComponent().displayElement.setHtml(value);return this;}
    });
    Ext.define('My.view.DisplayFieldComponent', {
    	extend: 'Ext.Component', xtype: 'displayFieldComponent', config: {cls: 'x-field-input'},
    	getTemplate: function() {return [{reference: 'displayElement', tag: 'div', style: 'padding:10px'}]}
    });
    The main change is "setValue", for allowing the field to behave like just another field when loading data into the form.

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