toushayouyi33 2016-08-23 11:48 采纳率: 0%
浏览 1110

extjs3.0 动态添加组件问题

 this.basePanel = new Ext.form.FieldSet(
                                        {
                                            title :"投票信息",
                                            layout :"form",
                                            border :true,
                                            items : [ {
                                                layout :"column",
                                                columnWidth :1,
                                                border :false,
                                                defaults : {
                                                    border :false
                                                },
                                                items : [
                                                        {
                                                            layout :"form",
                                                            columnWidth :1,
                                                            defaults : {
                                                                width :"80%"
                                                            },
                                                            items : [
                                                                    {
                                                                        xtype :"hidden",
                                                                        name :"vote.voteId",
                                                                        value :this.voteId != null ? this.voteId
                                                                                : ""
                                                                    },{
                                                                        xtype :"hidden",
                                                                        name :"vote.count",
                                                                        value:0
                                                                    },{
                                                                        anchor :"99%",
                                                                        xtype :"textfield",
                                                                        name :"vote.confTopic",
                                                                        fieldLabel :"投票标题",
                                                                        allowBlank :false,
                                                                    }, {
                                                                        columnWidth :1,
                                                                        anchor :"100%",
                                                                        layout :"form",
                                                                        height :160,
                                                                        border :false,
                                                                        items : [ {
                                                                            anchor :"98%",
                                                                            name :"vote.voteDesc",
                                                                            xtype :"htmleditor",
                                                                            height :150,
                                                                            fieldLabel :"投票描述",
                                                                            autoScroll :true,
                                                                            maxLength :4000
                                                                        } ]
                                                                    },{
                                                                            xtype :"button",
                                                                            iconCls :"menu-add",
                                                                            width:70,
                                                                            text :"增加投票项",
                                                                            scope :this,
                                                                            handler :this.addText
                                                                            }

                                                                     ]
                                                        } ]
                                            } ]
                                        });
                                        addText : function(){
                        var bp = this.basePanel;
                        var i = bp.getCmpByName("vote.count").getValue();
                        var fd = new Ext.Container({
                            fieldLabel :"投票选项",
                            columnWidth :1,
                            layout :"column",
                            border :false,
                            items : [ {
                                columnWidth :0.85,
                                anchor :"99%",
                                xtype :"textfield",
                                fieldLabel :"投票项",
                                name :"voteOption.voteDesc"+i,
                                allowBlank :false,
                            }, {
                                width :75,
                                defaultType :"button",
                                border :false,
                                items : [ {
                                    iconCls :"menu-del",
                                    text :"删除此项",
                                    scope :this,
                                    handler :function(){
                                        this.basePanel.remove(fd,true);
                                        this.basePanel.doLayout();
                                    }
                                }]
                            } ]
                        });
                        i++;
                        bp.getCmpByName("vote.count").setValue(i);
                        bp.add(fd);
                        console.log(bp)
                        bp.doLayout();
                        console.log(bp.getCmpByName("vote.count"));
                        //debugger;

                    }

核心代码如上所示,点击增加选项后创建新的Container,但是出现了奇怪的现象,添加到第八个后,这一块的布局出现错误图片说明
图片说明图片说明

  • 写回答

1条回答 默认 最新

  • Go 旅城通票 2016-08-24 01:25
    关注

    f12看下描述之类的容器是否还存在,可能是设置了最大高度,超过了直接隐藏起来了

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog