如题, 假如我这里有一行数据需要填写,后面有一个添加的按钮,当我每次点击添加按钮的时候,就在下面自动增加一行出来,我用的FormPanel,    var form = new Ext.form.FormPanel({
         collapsible: true,
         resizable:false,
        frame:true,
         labelWidth: 100,
         baseCls:'x-panel-noborder',
        buttonAlign:'center',
        items: [{
            layout: 'column',
            height: 40,
            baseCls: 'background-color:#FFFFFF',
            items: [{
                xtype: 'label',
                columnWidth: .10,
                html: '移动通道:',
                cls: 'label1'
            }, {
                xtype:'combo',
      id:'ydChannl',
         name:'ydChannl',
         allowBlank:false,
         store : yddyncStore,
emptyText : "请选择",
isFormField : true,
mode : "remote",
triggerAction : "all",
valueField : "value",
displayField : "text",
editable : false,
                columnWidth: .30
            },{
                xtype: 'label',
                columnWidth: .20,
                html: '通道分配比例:',
                cls: 'label1'
            },{
               xtype: 'combo',
               id: 'ydlevel',
               name: 'ydlevel',
               displayField: 'text',
               valueField: 'value',
               editable: false,
               store: new Ext.data.SimpleStore({
                    fields: ['value', 'text'],
                     data: [[0, '0.1'], [1, '0.2']]
               }),
               triggerAction: 'all',
               readOnly: true,
               mode: 'local',
               value: '1',
               columnWidth: .20
            },{
             xtype: 'button',
                columnWidth: .10,
                text: '添加',
                handler : function() {
                
                }
            }]
        }]
)}
这就是我的第一行,当我点添加的时候,怎么在添加的function里面写代码,自动在下面添加一行呢?有高手帮帮忙。。谢谢了。

解决方案 »

  1.   

    创建行,然后在insert到grid里面
      

  2.   

    这其实就是往items里边add相同的组件就是了 
    你自己封装一个方法 返回的是一个items 然后点add的时候 panel.add(这个items)就是了
      

  3.   

    var gridPanel = Ext.getCmp('idFileList');
    var Files = gridPanel.getStore().recordType;
    var files = new Files({
    file_id:file.id,
    file_name:file.name,
    file_size:getNiceFileSize(file.size),
    file_state:"等待上传",
    file_op:"<a href=\"#\" id=\""+file.id+"_del\">取消</a>"
    });
    gridPanel.getStore().add(files);
    gridpanel 动态添加行的方法希望对你有帮助