Results 1 to 2 of 2

Thread: build the name config to reuse form

  1. #1
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    64
    Answers
    6
    Vote Rating
    5
      0  

    Default 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
    574
    Answers
    59
    Vote Rating
    74
      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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •