一:经常使用工具条上的定义

// 工具条
var toolbar = Ext.create("Ext.Toolbar", {
            items : [ yearCbo,zoneCbo,indexCbo,srchBtn]
        }); // 年度
var yearCbo = {
        xtype : 'numberfield',
        id : 'toolbar_year',
        name : 'year',
        fieldLabel : '年度',
        labelWidth : 40,
        allowBlank : false,
        blankText : '请选择年度',
        width : 100,
        value : new Date().getFullYear()-1,
        maxValue : new Date().getFullYear(),
        minValue : 2013
        
    }; // 月份
var monthCbo ={
    xtype : 'numberfield',
    id : "mounth",
    fieldLabel : '月份',
    labelWidth : 40,
    editable :false,
    allowbBlank : true,
    width : 100,
    maxValue : 12,
    minValue : 1,
    value : new Date().getMonth()+1
} // 查询按钮
var srchBtn = {
        xtype : 'button',
        id : 'srchBtn',
        text : '查询',
        iconCls : 'searchicon',
        listeners:{
            click:function(){
                alert(123456) ;
           }
        }
};

二:combox的定义使用

// store定义
var indexStore = new Ext.data.Store({
    fields:["value","name"],
    proxy: {
          type: 'ajax',
          url: 'Summary_getEnmuList?ENMU_CODE=24'
      },
      autoLoad: false,
      remoteSort:true,
      reader:{
            type:'json'
    }
});
// 改变store的值(这里添加一项)
indexStore.load({
    callback: function(records, operation, success) {
        // do something after the load finishes
        var allIndexRecord = {name:"測试首项",  value: -99 };
        indexStore.insert(0,allIndexRecord);
    },
    scope: this
}); // 定义combox
var indexCbo = {
            xtype : 'combobox',
            id : 'toolbar_indexCbo',
            name : 'indexCbo',
            fieldLabel : '11 项指标',
            labelWidth : 70,
            width : 220,
            value : '01',
            queryMode : 'local',// [local|remote]
            store : indexStore,
            editable : false,
            emptyText : '---请选择---',
            allowBlank : false,
            blankText : '请选择指标',
            displayField : 'name',
            valueField : 'value'
};

三:定义控件的值获取

Ext.getCmp('cbo').getValue()。
Ext.getCmp('cbo').getRawValue()。

四:Ext.form.Panel

var form=Ext.create('Ext.form.Panel',{
items:[toolbar]
});
var myform = form.getForm();
if(myform.isValid()){
myform.submit({
url : 'test.action',
method : 'POST',
type : 'ajax',
waitTitle : "提示",// 等待的标题
waitMsg : '正在提交数据...',// 等待的信息
success : function(fp, o) {
if (o.result.success == 'true') {
myGrid.store.loadPage(1);
}
Ext.Msg.alert('提示',o.result.message);
},
// 404或者500错误就会运行
failure : function(fp, o) {
Ext.Msg.alert('提示','出现异常');
}
});
}

五:高速创建简单mvc

AM.view.TestList

Ext.define('AM.view.TestList', {
extend : 'Ext.form.Panel',
alias : 'widget.testList',
frame : true,// 面板渲染
columnLines : true, // 行线
multiSelect : true,// 执行多选
forceFit : true,// 自己主动填充panel空白处
autoScroll: true,
initComponent : function() {
this.id = 'testList';
var myPanle = new Ext.Panel({
bodyStyle:'background-color:#FFFFFF',
html:'測试页面',
height:'100%'
}) ; this.items = [ myPanle]; this.callParent(arguments);
}
});

AM.controller.TestController

Ext.define('AM.controller.TestController', {
extend : 'Ext.app.Controller',
views : ['testList'],
init : function() {
this.control({
});
}
});

Ext4.0 经常使用代码整理(一)的更多相关文章

  1. Smtp邮件发送系统公用代码整理—总结

    1.前言 a.在软件开发中,我们经常能够遇到给用户或者客户推送邮件,推送邮件也分为很多方式,比如:推送一句话,推送一个网页等等.那么在系统开发中我们一般在什么情况下会使用邮件发送呢?下面我简单总结了一 ...

  2. NSIS常用代码整理

    原文 NSIS常用代码整理 这是一些常用的NSIS代码,少轻狂特意整理出来,方便大家随时查看使用.不定期更新哦~~~ 1 ;获取操作系统盘符 2 ReadEnvStr $R0 SYSTEMDRIVE ...

  3. material design 的android开源代码整理

    material design 的android开源代码整理 1 android (material design 效果的代码库) 地址请点击:MaterialDesignLibrary 效果: 2 ...

  4. HTTP请求代码整理

    HTTP请求代码整理 类别 代码 注释 1xx – 信息提示 100 继续 101 切换协议 2xx - 成功 200 确定.客户端请求已成功 201 已创建 202 已接受 203 非权威性信息 2 ...

  5. SQL代码整理

    --SQL代码整理: create database mingzi--创建数据库go--连接符(可省略)create table biao--创建表( lieming1 int not null,-- ...

  6. IOS常用代码整理

    常用代码整理: 12.判断邮箱格式是否正确的代码: //利用正则表达式验证 -(BOOL)isValidateEmail:(NSString *)email { NSString *emailRege ...

  7. (jsp/html)网页上嵌入播放器(常用播放器代码整理) http://www.jb51.net/article/37267.htm

    网页上嵌入播放器,只要在HTML上添加以上代码就OK了,下面整理了一些常用的播放器代码,总有一款适合你,感兴趣的朋友可以参考下哈,希望对你有所帮助   这个其实很简单,只要在HTML上添加以上代码就O ...

  8. html Css PC 移动端 公用部分样式代码整理

    css常用公用部分样式代码整理: body, html, div, blockquote, img, label, p, h1, h2, h3, h4, h5, h6, pre, ul, ol, li ...

  9. webpack4.0打包优化策略整理小结

    本文转载于:https://www.jb51.net/article/137449.htm 介绍了webpack4.0打包优化策略整理小结,分享给大家,具体如下: webapck4 新特性介绍-参考资 ...

随机推荐

  1. (转)String StringBuilder StringBuffer 对比 总结得非常好

    来源:http://blog.csdn.net/clam_clam/article/details/6831345 转自:http://www.iteye.com/topic/522167 作者:每次 ...

  2. python3 之 Ellipsis

    在翻django 代码的时候无意中看到的, 主要还是在注解时候使用 官方参考:https://docs.python.org/3/library/constants.html#Ellipsis 注意: ...

  3. (noip模拟十七)【BZOJ3930】[CQOI2015]选数-容斥水法

    Description 我们知道,从区间[L,H](L和H为整数)中选取N个整数,总共有(H-L+1)^N种方案.小z很好奇这样选出的数的最大公约数的规律,他决定对每种方案选出的N个整数都求一次最大公 ...

  4. codevs 1288 埃及分数 (迭代加深搜索)

    题目大意:给你一个分数$a/b$,把它拆解成$\sum_{i=1}^{n}1/ai$的形式,必须保证$ai$互不相同的情况下,尽量保证n最小,其次保证分母最大的分数的分母最小 什么鬼玄学题!!! 因为 ...

  5. 线性规划(LP)资料下载

    1.学习用PPT harvard gondzio IOE610 mit cxg286 含matlab程序 2.测试库 BPMPD netlib fsu 3.软件测试 BENCHMARKS FOR OP ...

  6. java流与文件的操作 文件加密

    课后作业 1,源代码 import java.io.*; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttribu ...

  7. 紫书 例题8-9 UVa 1451 (数形结合)

    这道题用了数形结合, 真的牛逼, 完全想到不到还可以这么做 因为题目求的是平均值, 是总数除以个数, 这个时候就可以联系 到斜率, 也就是说转化为给你一堆点, 让你求两点之间的最大斜率 要做两个处理 ...

  8. C语言中static的使用

    在开发过程中.我们常常会须要定义一些static类型的变量或者函数.我们接下来来详细聊一下static: 1.修饰变量 当static来修饰一个变量时,就注定了这个变量的可见范围和生命周期: (1)当 ...

  9. 基于UDP的DDos反射放大攻击

    转自:https://www.us-cert.gov/ncas/alerts/TA14-017A Protocol Bandwidth Amplification Factor DNS 28 to 5 ...

  10. Reading and writing

    A text file is a sequence of characters stored on a permanent medium like a hard drive, flash memory ...