开发者

Problem with dynamically adding element to formField Extjs 2

开发者 https://www.devze.com 2023-04-05 20:30 出处:网络
I Have a fieldset inside a FormPanel. I am adding an element to \'fieldset\' dynamically. But this element is getting added at the bottom of \'fieldset\'where as I want to add this element as a first

I Have a fieldset inside a FormPanel. I am adding an element to 'fieldset' dynamically. But this element is getting added at the bottom of 'fieldset'where as I want to add this element as a first element of my 'fieldset' i.e. on the top. How can I do that? Can someone help me?

My code for 'fieldset':

      var List = {
        xtype :'fieldset',
        id :'List',
        title :List,
        autoHeight :true,
        items : [ 
        {
            xtype :'button',
            id :'save',
            text :save,
            handler : function() {
              ......
            }
        }, 
        开发者_运维问答grid ]
    };

Code to add element:

    Ext.getCmp('List').add(
        {
            html :'Error'
        });
   Ext.getCmp('panel').doLayout();       

Thanks...


Try to use the insert(index,component) function:

Ext.getCmp('List').add(
              yourCompnent
        );
Ext.getCmp('List').insert(0,yourCompnent);

Ext.getCmp('panel').doLayout(); 
0

精彩评论

暂无评论...
验证码 换一张
取 消