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();}
      }
    }
}

EXTJS textfiled为空的默认提示

emptyText:'请选择!',

EXTJS 设置comob多选

selModel :{
    mode: 'Multi'
},

EXTJS 设置Grid单选,多选,全选

selModel: {
    selection: "rowmodel",
    mode: "MULTI"
},

   配置项mode,可用的值为:

  • SINGLE:单行选择(默认)
  • SIMPLE:多行选择,单击选中/取消选中行
  • MULTL:多行选择,支持CTRL、SHIFT功能键,如果要进行多选,需要按住ctrl键。用shift可以进行区域选择

 EXTJS Combo、ComboGrid选中监听事件

Ext.ComponentMgr.get("CDT_itemCode").on('select',function (combo, record, eOpts){
        var item = record.get('itemCode');
        Ext.getCmp('CDT_item').setValue(item);
    });

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值