1. #1
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    64
    Answers
    6
    Vote Rating
    5
    AssetWorks is on a distinguished road

      0  

    Default Answered: build the name config to reuse form

    Answered: build the name config to reuse form


    I have an address class that I want to reuse. but I want to build the name in each field to have a prefix and so when I call that xtype I want to be able to pass in this prefix so that each time it matches the field.
    Code:
        Ext.define('myForm',{
            extends:'Ext.form.Panel',
            prefix:'ShippingAddress', //<--------I want to define my prefix here
            alias:'widget.myform',
            items:[
                 {xtype: 'textfield', name: {prefix}+'Line1'},
                 {xtype: 'textfield', name: {prefix}+'City'},
                 {xtype: 'textfield', name: {prefix}+'State'}
                 // .....etc... 
        });
    so I can do this later:
    Code:
        ....
         xtype: 'myform',
         prefix: 'BillingAddress'

  2. This is possible (you need to define items in initComponent method), but I advise to factor out address to a separate entity and then have a collection of them/ several hasOne associations.

  3. #2
    Sencha User
    Join Date
    Sep 2011
    Posts
    573
    Answers
    58
    Vote Rating
    71
    ettavolt is just really nice ettavolt is just really nice ettavolt is just really nice ettavolt is just really nice

      0  

    Default


    This is possible (you need to define items in initComponent method), but I advise to factor out address to a separate entity and then have a collection of them/ several hasOne associations.

Thread Participants: 1

Tags for this Thread