passionjackychen 2012-09-05 20:32
浏览 308
已采纳

EXT 列布局 各列不在同一行上

我在用EXT做一个查询的页面时,整体采用的form布局,然后各行采用列布局,但是显示出来后,各行不在同一行上,不能对齐,如下图,这个应该怎么来调整呢?麻烦大家帮帮忙,谢谢啦


 

代码如下:

 var _search = new Ext.form.FormPanel({

         title : "查询",
            columnWidth : 1,
            collapsible:true,
            autoHeight : true,
            frame : true,
            renderTo : 'panelSearch',
            layout : "form", // 整个大的表单是form布局
            //labelWidth : 65,
            labelAlign : "right",
            titleCollapse: true,
            items : [{ // 行1
                layout : "column", // 从左往右的布局
                items : [{
                    columnWidth : .25, // 该列有整行中所占百分比
                    layout : "form", // 从上往下的布局
                    items : [
                        kind
                    ]
                }, {
                    columnWidth : .2,
                    layout : "form",
                    items : [{
                        xtype:'textfield',
                        //labelWidth: 125,
                        //width: 120,
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel: '<s:property value="%{getText('componentName')}"/>',
                        name: 'jmeComponents.componentName',
                        id: 'componentName',
                        value:'<s:property value="jmeComponent.componentName"/>',
                        readOnly: false,
                        allowBlank:true,
                        maxLength : 32
                    }]
                }, {
                    columnWidth : .4,
                    layout : "form",
                    items : [{
                        buttons:[{
                            text: '<s:property value="%{getText('select')}"/>',
                            id:'queryId',
                            type: 'submit',
                            handler: function(){
                                  if(_search.getForm().isValid()){//验证合法后使用加载进度条
                                    var grid = Ext.getCmp("gridPowerCount");
                                    var store = grid.getStore();

                                    //机房名称
                                    var serverRoomId = Ext.getCmp("serverRoomId").getValue();
                                    
                                    var componentName = Ext.getCmp("componentName").getValue();
                                    store.baseParams["jmeComponent.serverRoomId"] = serverRoomId;
                                    store.baseParams["jmeComponent.componentName"] = componentName;
                                    var url = Ext.urlEncode(store.baseParams);
                                    store.load();
                               }
                            }
                        }]
                    }]
                }]
            }, {// 行2
                layout : "column",
                items : [{
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchA",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "A路功率(KW)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchB",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "B路功率(KW)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchC",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "C路功率(KW)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchD",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "D路功率(KW)",
                        width : 100
                    }]
                },  
                {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchCount",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "总功率(KW)",
                        width : 100
                    }]
                }]
            }, {// 行3
                layout : "column",
                items : [{
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchEnergyA",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "A路电能(KWH)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchEnergyB",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "B路电能(KWH)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchEnergyC",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "C路电能(KWH)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchEnergyD",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "D路电能(KWH)",
                        width : 100
                    }]
                },
                {
                    layout : "form",
                    columnWidth : 0.2,
                    items : [{
                        xtype : "textfield",
                        id : "branchEnergyCount",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "总电能(KWH)",
                        width : 100
                    }]
                }]
            }]
        });
  • 写回答

2条回答 默认 最新

  • works001 2012-09-05 20:46
    关注

    [code="java"]var form = new Ext.form.FormPanel({
    title : "查询",
    //columnWidth : 1,
    collapsible:true,
    autoHeight : true,
    frame : true,
    layout : "form", // 整个大的表单是form布局
    //labelWidth : 65,
    labelAlign : "right",
    renderTo : 'panelSearch',
    titleCollapse: true,
    items : [{ // 行1
    layout : "column", // 从左往右的布局
    items : [{
    columnWidth : .2, // 该列有整行中所占百分比
    layout : "form", // 从上往下的布局
    items : [{
    xtype:'textfield',
    anchor:"98%",
    //labelWidth: 125,
    //width: 120,
    //labelStyle:'color: #396095;font-weight:bold',
    fieldLabel: 'xxx',
    name: 'jmeComponents.componentName',
    //id: 'componentName',
    value:'xxx2',
    readOnly: false,
    allowBlank:true,
    maxLength : 32
    }]
    }, {
    columnWidth : .2,
    layout : "form",
    items : [{
    xtype:'textfield',
    anchor:"98%",
    //labelWidth: 125,
    //width: 120,
    labelStyle:'color: #396095;font-weight:bold',
    fieldLabel: 'xxx',
    name: 'jmeComponents.componentName',
    // id: 'componentName',
    value:'xxx2',
    readOnly: false,
    allowBlank:true,
    maxLength : 32
    }]
    }, {
    columnWidth : .3,
    layout : "form",
    items : [{
    xtype:"button",
    text: '323232',
    id:'queryId',
    type: 'submit',
    handler: function(){
    if(_search.getForm().isValid()){//验证合法后使用加载进度条
    var grid = Ext.getCmp("gridPowerCount");
    var store = grid.getStore();

                                    //机房名称
                                    var serverRoomId = Ext.getCmp("serverRoomId").getValue();
    
                                    var componentName = Ext.getCmp("componentName").getValue();
                                    store.baseParams["jmeComponent.serverRoomId"] = serverRoomId;
                                    store.baseParams["jmeComponent.componentName"] = componentName;
                                    var url = Ext.urlEncode(store.baseParams);
                                    store.load();
                               }
                            }
    
                    }]
                }]
            }, {// 行2
                layout : "column",
                items : [{
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchA",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "A路功率(KW)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchB",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "B路功率(KW)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchC",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "C路功率(KW)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchD",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "D路功率(KW)",
                        width : 100
                    }]
                },  
                {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchCount",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "总功率(KW)",
                        width : 100
                    }]
                }]
            }, {// 行3
                layout : "column",
                items : [{
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchEnergyA",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "A路电能(KWH)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchEnergyB",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "B路电能(KWH)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchEnergyC",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "C路电能(KWH)",
                        width : 100
                    }]
                }, {
                    layout : "form",
                    columnWidth : .2,
                    items : [{
                        xtype : "textfield",
                        id : "branchEnergyD",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "D路电能(KWH)",
                        width : 100
                    }]
                },
                {
                    layout : "form",
                    columnWidth : 0.2,
                    items : [{
                        xtype : "textfield",
                        id : "branchEnergyCount",
                        labelStyle:'color: #396095;font-weight:bold',
                        fieldLabel : "总电能(KWH)",
                        width : 100
                    }]
                }]
            }]
        });[/code]  你测试下我的代码看看
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化