1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    86
    Vote Rating
    0
    newusername is on a distinguished road

      0  

    Default How to show fields on form panel

    How to show fields on form panel


    HI ,

    If I have a form panel which contains say employee name , last name and salary and tax based on that salary.
    Initially I will show all elements except tax .
    When users fill up all the details and after saving , at server end I will calculate tax and will come back on same form showing all fields as readable along with tax field.

    I mean
    1. initially DOM should not contain tax field but later on it should... How can I do that ?
    2. How can I show those fields as readable only ..

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    51
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Quote Originally Posted by newusername View Post
    1. initially DOM should not contain tax field but later on it should... How can I do that ?
    The easiest method would be to always include the field in the form, but hide it as default (hidden:true). Once you have completed the AJAX call, show the field and populate it with your received value.
    http://docs.sencha.com/ext-js/3-4/#!...eld-cfg-hidden

    Quote Originally Posted by newusername View Post
    2. How can I show those fields as readable only ..
    Simply set the field as readOnly: true:
    http://docs.sencha.com/ext-js/3-4/#!/api/Ext.form.TextField-cfg-readOnly
    http://docs.sencha.com/ext-js/3-4/#!...od-setReadOnly

    I would also recommend purchasing a decent book on EXTJS which should be able to teach you all the basics like this in a few hours. I heartily suggest the "ExtJS In Action" book by Jay Garcia

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    86
    Vote Rating
    0
    newusername is on a distinguished road

      0  

    Default


    Thanks for ur reply

    Quote Originally Posted by willigogs View Post
    The easiest method would be to always include the field in the form, but hide it as default (hidden:true).
    but till if I do not wish that item to be in DOM .. what shall I do ?

    Surely I will go through that book .

  4. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    51
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Quote Originally Posted by newusername View Post
    but till if I do not wish that item to be in DOM .. what shall I do ?
    Use either the add() or insert() methods:
    http://docs.sencha.com/ext-js/3-4/#!...Set-method-add
    http://docs.sencha.com/ext-js/3-4/#!...-method-insert

Thread Participants: 1