Results 1 to 7 of 7

Thread: Create a row of new Elements in ExtJS

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Bangalore,IN
    Posts
    114
    Answers
    6

    Default Create a row of new Elements in ExtJS

    I want to create a new row of items, say textfield, textarea(with labels) inside a Panel.

    I tried searching and I found a example in http://jsfiddle.net/chrisramakers/ZcQAX/

    B
    ut this is with the HTML table. How can the same be implemented inside a Panel or Window ?

    Thanks,

  2. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,102
    Answers
    113

    Default

    you can simply create a textfield and add it to your panel:

    Code:
    newTextField = new Ext.form.field.Text({
      fieldLabel: 'blah'
    });
    
    panel.add(newTextField);
    this would add a text field to your panel.

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    Bangalore,IN
    Posts
    114
    Answers
    6

    Default

    With a Add Button will it be added ?

  4. #4
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,102
    Answers
    113

    Default

    yes. you have to put this code in the handler of the add button as in the example you posted.

  5. #5
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    250
    Answers
    44

    Default example

    PHP Code:
    Ext.onReady(function(){
        var 
    panel Ext.create('Ext.panel.Panel', {
            
    title'Test',
            
    width400,
            
    height400,
            
    renderToExt.getBody(),
            
    layout: {
                
    type'vbox',
                
    align'stretch'
            
    },
            
    autoScrolltrue,        
            
    tbar: [
                {
                    
    text'Add row',
                    
    handler: function (btn) {
                        var 
    panel btn.up('panel'),
                            
    row = {
                                
    xtype'container',
                                
    layout'hbox',
                                
    padding5,
                                
    items: [
                                    {
                                        
    xtype'textfield'
                                        
    fieldLabel'f1',
                                        
    labelAlign'top',
                                        
    flex1
                                    
    },
                                    {
                                        
    xtype'textarea'
                                        
    fieldLabel'f2',
                                        
    labelAlign'top',
                                        
    flex1
                                    
    }
                                ]
                            };
                        
                        
    panel.add(row);
                    }
                }
            ]
        });
    });

    http://jsfiddle.net/pARkd/2/

  6. #6
    Sencha User
    Join Date
    Aug 2011
    Location
    Bangalore,IN
    Posts
    114
    Answers
    6

    Default

    Thanks all for replying. I got a perfect example here...


    http://www.extjsframework.com/ext-4....lds/index.html

  7. #7
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    It might be helpful for others to share your code?

    Scott.

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
  •