extjs遇到的问题总结

来源:互联网 发布:大数据挖据市场前景 编辑:程序博客网 时间:2024/05/22 06:38

 (1)根据id获取extjs元素

    document.getElementById("myIframe")

    var form = Ext.getCmp("modifyPurviw_form").getForm();

2)空白有提示 需要在ext.onready里面加入

Ext.QuickTips.init();

allowBlank: false,

blankText:"用户登陆名不能为空",

3)使得formpanel的位置居中,在formpanel的属性中加入

var form = new Ext.form.FormPanel({

//style : 'margin:0 50 50 0',

style:{

        marginRight: 'auto',

        marginLeft: 'auto'

},

(4)定位问题

position:relative;指的是相对于组件原来的位置偏移量。

left:-20px

绝对定位 是相对浏览器或者父容器,建立坐标系。利用坐标系来定位。

Padding内边距 是指靠各个单元格各边的距离

5)采用form布局注意的问题

窗体顶端

extjs表单布局对于新手来说真是一大难题,不过掌握了其中技巧,运用起来就得心应手了

1.先用

new Ext.FormPanel({

items:[

{...},{...},{...}

]

})

类似的代码,确定整个form的行数,即items{}的个数。

2. 每行如果要分列,再利用

{

layout:"column",

items:[{},{},{}...]

}

column布局,横向分切为N,items:[{},{},{}...]{}的个数

3. 每列中,如果要放输入项,再把每行相关列(其实就是单元格),采用form布局方式处理,并标明输入项,类似以下代码:

items: [{

columnWidth: 0.5,

layout: "form",

items: {

xtype:"textfield",

fieldLabel:"A1",

anchor:"90%"

}

}, {

columnWidth: 0.5,

html: "aaaaaaaaaaa"

}]

formPanel form布局)里面修改lableWidth才能有效更改feildLabel的宽度。

如果blankText不提示,则在onReady方法中加入 Ext.QuickTips.init();

如果更改labeltext值需要设置Ext.getCmp('sourceLocationLabel').setText("目标表:);

如果两个label需要分为两行显示 除了设置form布局之外,应该选择注意标红的部分。要将其设置为单独的一项,里面具有items属性,在子items里添加自己要设置的内容。

items : [

 {

 layout:"form",

 items:[  

                                {

                                text:"步骤5/7      你可以设置栏位定位。设置源栏位和目的栏位之间的对应关系",

                              xtype: "label"

                                  }

    ]

 

 },

 

{

id:"sourceLocationLabel",

text:"",

                 xtype: "label"

                     

                

},

{

id:"destinationLabel",

text:"目标表:"+tableName,

xtype: "label"

},

grid

]

将数据从json string格式转化为自己想要的数据。

public ImportDBConfig parseImportCfg_json(String json_cfgthrows ImportParameterException

{

JSONObject jo=JSONObject.fromObject(json_cfg);

//JSONObject importParam_jo=jo.getJSONObject("importParam");

String importType=jo.getString("importType");

if(importType.equalsIgnoreCase(STRING_IMPORT_TXT))

{

//txt分为两者 (1. CSV 2. 定长)

if(jo.getBoolean("fixedWidth"))

{

return null;

}else

{

return parseImportCfg_json_csv(jo);

}

}

return null;

}

 

 

窗体底端

 

0 0