ExtJS 6.2开发笔记

表单reset无法重置ComboGrid

调用form1.getForm().reset();时发现,如果ComboGrid原本有值,表单reset无法重置ComboGrid

试过了:clear(); removeAll(); setValue(null);都无效果

办法:ComboGrid.setValue("");成功

js判断undefined类型

 if (reValue== undefined){}
发现判断不出来,最后查了下资料要用typeof
方法:
if (typeof(reValue) == "undefined") {}  

typeof 返回的是字符串,有六种可能:"number"、"string"、"boolean"、"object"、"function"、"undefined"

EXTJS 手动控制textarea换行

js中使用 \n 标签,格式如下

var result = 'code:'+code+'\nmessage:'+message+'\nstatus:'+status+'';
Ext.getCmp('stock_result').setValue(result);

\n 不需要和后面变量空一格,这样换行后可以保持对其

EXTJS  textarea自适应高度

grow:true

EXTJS  格式化时间格式

var date = Ext.Date.format(new Date(),"Y-m-d H:i:s");

EXTJS  动态设置ExtJS Form控件文字显示的颜色

Ext.getCmp('simpletxt').setFieldStyle('color:red');

EXTJS  panel触发渲染完成的方法Render

xtype: 'panel',
plugins: 'responsive',
layout: 'fit',
region: 'south',
listeners: {render: function() {}}                                        
                            

EXTJS 更新html内容

Ext.getCmp('stockEoBarcode_result').update("<iframe width=900px height=900px id='myframe'name='myframe' src='jsBarcode.ftl?code="+lpnCodes+"'  frameborder=0 border=0 marginwidth=0 marginheight=0  allowtransparency='yes'></iframe>");

EXTJS form.Panel   load事件


    formGrid.getForm().load({
        url : ...,
        headers : {"access_token": access_token},
        method : 'POST',
        async:false,
        params : {warehouseId: "3432cdb5"},
        success : function (form,action) {
            formGrid.getForm().setValues({
                mitQty:action.result.object.totalMitQty,
            })
        },
        failure: function (form,action) {
           
        }
    });

EXTJS Ajax.request异步请求方法

Ext.Ajax.request({
    url : ...,
    defaultHeaders : {"access_token": access_token},
    params : {warehouseId: "3432cdb5"},
    datatype: 'JSON',
    method: 'POST',
    success : function(response) {
        console.log(response);
        var json = JSON.parse(response.responseText);
        Ext.getCmp('totalQty').setValue(json.object.totalQty + " 箱");                                       
    },
    failure: function (response, options) {
        console.log(response);
    }
});

EXTJS textarea已逗号间隔,去掉最后一个逗号

var arr = lpnCode.split("\n");
var lpnCodes = "";
for (var i = 0; i < arr.length; i++) {
     // 这里将每一行继续按逗号拆分:split(/[符号1、符号2]/)
     lpnCodes = lpnCodes + arr[i] + ",";
}
lpnCodes = lpnCodes.substring(0,lpnCodes.length-1);

EXTJS 判断以XX开头或结尾

var str  = "XY,"
str.endsWith(",") --返回true
str.startsWith("X") --返回true

EXTJS 文本框添加图标

{
xtype : 'textfield',
columnWidth : 0.2,
name : 'goodsName',
fieldLabel : '商品名称',
emptyText : '请输入...',
triggers : {
bar : {
    cls : Ext.baseCSSPrefix+ 'form-clear-trigger',
    handler : function() {this.reset();}
      }
    }
}

猜你喜欢

转载自blog.csdn.net/m0_37787662/article/details/88394611
今日推荐