1. #1

    Join Date
    Feb 2013
    Location
    India
    Posts
    12
    Vote Rating
    0
    chakra1234 is on a distinguished road

      0  

    Default Assign Prototype string to text fileld from Sencha Architect Config Window

    Assign Prototype string to text fileld from Sencha Architect Config Window


    I am doing localization in view as per ExtJS prototype overriding.
    I have created prototype as "FormTitle" in a view using Sencha Architect config window.
    While assigning the window title as this.FormTitle from Sencha Architect config window,
    it adds as string 'this.FormTitle' , not as a prototype. So while running the app, it displays as 'this.FormTitle' not as 'Material Editor'

    My Code generated by Architect as below

    Ext.define('TestConfig.view.MaterialEditor', {
    extend: 'Ext.window.Window',
    alias: 'widget.materialeditor',

    FormTitle: 'Material Editor',
    height: 541,
    itemId: 'MaterialEditor',
    width: 659,
    layout: {
    type: 'fit'
    },
    title: 'this.FormTitle',
    defaultFocus: 'txtMaterialName',
    maximizable: true,
    ..........

    Any suggestion how to do from Sencha Architect Config Window , will be help full.
    Thanks

  2. #2
    Sencha - Architect Dev Team dfoelber's Avatar
    Join Date
    Sep 2011
    Location
    Rockville, MD
    Posts
    96
    Vote Rating
    12
    dfoelber will become famous soon enough

      0  

    Default


    Hi,

    You can add a process config function to your window to set the title.

    There is a guide here: http://docs.sencha.com/architect/2/#...anel-section-8
    David Foelber
    @davidfoelber
    Sencha Architect Development Team

  3. #3

    Join Date
    Feb 2013
    Location
    India
    Posts
    12
    Vote Rating
    0
    chakra1234 is on a distinguished road

      0  

    Default


    Thanks for the reply.
    But my problem is not with setting title. Let me explain.
    I am trying to localize a form (title,button text,labels etc.) using the approach defined in the ExtJS document.

    Code taken from ExtJS Localization Sample.

    Ext.define('Ext.app.ContactForm', { extend: 'Ext.form.Panel', requires: [ 'Ext.data.ArrayStore', 'Ext.data.reader.Array', 'Ext.form.field.ComboBox', 'Ext.form.field.Date' ], formTitle: 'Contact Information (English)', firstName: 'First Name', lastName: 'Surname', surnamePrefix: 'Surname Prefix', company: 'Company', state: 'State', stateEmptyText: 'Choose a state...', email: 'E-mail', birth: 'Date of Birth', save: 'Save', cancel: 'Cancel', initComponent : function(config) { Ext.apply(this, { url: 'save-form.php', frame: true, title: this.formTitle, bodyStyle: 'padding:5px 5px 0', width: 370, defaultType: 'textfield', defaults: { width: 330 }, items: [{ fieldLabel: this.firstName, name: 'firstname', allowBlank:false },{ fieldLabel: this.lastName, name: 'lastName' },{ fieldLabel: this.surnamePrefix, width: 150, name: 'surnamePrefix'In the above code, label text is set using variables

    fieldLabel: this.firstNameBut in my case when i add the same thing (this.firstName) for the fieldLabel from the Sencha Architect it does not consider as variable instead as string 'this.firstName'

  4. #4
    Sencha - Architect Dev Team dfoelber's Avatar
    Join Date
    Sep 2011
    Location
    Rockville, MD
    Posts
    96
    Vote Rating
    12
    dfoelber will become famous soon enough

      0  

    Default


    You can place a processConfig on the text field. It will look a little like this:

    Code:
    me.processMyTextField({
        xtype: 'textfield',
        anchor: '100%',
        fieldLabel: 'Label',
        allowBlank: false
    })
    The process config function would look like this:

    Code:
    processMyTextField: function(config) {
        config.fieldLabel = this.firstName;
        return config;
    }
    David Foelber
    @davidfoelber
    Sencha Architect Development Team

Thread Participants: 1

Tags for this Thread