当前位置: 首页 > news >正文

extjs4学习之配置

最近在学习extjs4发现一篇文章中有错误,网上很多人都是直接复制粘贴那篇文章,结果每个人注释中都是写的正确的答案,我也是醉了,这些猿么复制粘贴代码都不带检查的么,为啥都变得很浮躁了呢。

现提供可以调试的代码:

html文件很简单,就引入ext资源和自定义的js文件就可以了。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试配置</title>
    <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css">
    <script type="text/javascript" src="../../ext-all-debug-w-comments.js"></script>
    <script type="text/javascript" src="class2.js"></script>
</head>
<body>
 
</body>
</html>

js文件就是定义了2个类,一个window,一个bottomBar,其中window中包含bottomBar对象,具体代码如下:

/**
 * Created by catcher on 2016-3-30.
 */
Ext.define('My.own.Window',{
    /** @readonly */
    isWindow:true,
    config:{
        title:'This title',
        bottomBar:{
            enable:false,
            height:10,
            resizable:false
        }
    },
    constructor:function(config){
        this.initConfig(config);
        return this;
    },
    applyTitle:function(title){
        if(!Ext.isString(title)||title.length==0){
            alert("Error: Title must be a valid non-empty string!");
        }else{
            return title;
        }
    },
    applyBottomBar:function(bottomBar){
        if(bottomBar && bottomBar.enable){
            if(!this.bottomBar){
                return Ext.create('My.own.WindowBottomBar',bottomBar);
            }else{
                this.bottomBar.setConfig(bottomBar);
            }
        }
    }
});
 
Ext.define('My.own.WindowBottomBar',{
    config:{
        enable:true,
        height:10,
        resizable:false
    },
    constructor:function(config){
        this.initConfig(config);
        return this;
    }
});
 
var myWindow = Ext.create('My.own.Window', {
    title: 'Hello World',
    bottomBar: {
        enable: true,
        height: 60,
        resizable: true
    }
});
 
console.log(myWindow.getTitle()); // "Hello World"
myWindow.setTitle('Something New');
console.log(myWindow.getTitle()); // "Something New"
myWindow.setTitle(null); // alerts "Error: Title must be a valid non-empty string!"
console.log(myWindow.getBottomBar().getHeight());
myWindow.setBottomBar({enable:true,height:100}); // Bottom bar's height is changed to 100
console.log(myWindow.getBottomBar().getHeight());

相关文章:

  • iptables练习
  • 大数据分析之hadoop的基本学习1-VMwae+Ubuntu
  • JavaScript的two-sum问题解法
  • nginx ssl
  • 关于Java内部类的初始化
  • noi 1.5 45:金币
  • nginx location配置
  • ArcGIS Engine 编辑- IWorkspaceEdit
  • Access-Control-Allow-Origin与跨域
  • linux下alsa架构音频驱动播放wav格式文件
  • [转].NET Core配置文件加载与DI注入配置数据
  • Makefile注意点总结
  • 深入浅出Puppet(一)
  • Mirco F-measure and Macro F-measure
  • mac上使用zsh配置环境变量
  • 【从零开始安装kubernetes-1.7.3】2.flannel、docker以及Harbor的配置以及作用
  • 0x05 Python数据分析,Anaconda八斩刀
  • 2017-08-04 前端日报
  • Brief introduction of how to 'Call, Apply and Bind'
  • FastReport在线报表设计器工作原理
  • Lsb图片隐写
  • Map集合、散列表、红黑树介绍
  • nginx(二):进阶配置介绍--rewrite用法,压缩,https虚拟主机等
  • ubuntu 下nginx安装 并支持https协议
  • yii2权限控制rbac之rule详细讲解
  • 编写高质量JavaScript代码之并发
  • 分类模型——Logistics Regression
  • 前端每日实战:61# 视频演示如何用纯 CSS 创作一只咖啡壶
  • 使用 Docker 部署 Spring Boot项目
  • 提升用户体验的利器——使用Vue-Occupy实现占位效果
  • 微信小程序上拉加载:onReachBottom详解+设置触发距离
  • 一些css基础学习笔记
  • 硬币翻转问题,区间操作
  • 终端用户监控:真实用户监控还是模拟监控?
  • 1.Ext JS 建立web开发工程
  • 400多位云计算专家和开发者,加入了同一个组织 ...
  • puppet连载22:define用法
  • (173)FPGA约束:单周期时序分析或默认时序分析
  • (C#)if (this == null)?你在逗我,this 怎么可能为 null!用 IL 编译和反编译看穿一切
  • (pojstep1.1.2)2654(直叙式模拟)
  • (vue)页面文件上传获取:action地址
  • (附源码)基于SSM多源异构数据关联技术构建智能校园-计算机毕设 64366
  • (亲测成功)在centos7.5上安装kvm,通过VNC远程连接并创建多台ubuntu虚拟机(ubuntu server版本)...
  • (转)socket Aio demo
  • (转)Windows2003安全设置/维护
  • .gitignore文件—git忽略文件
  • .NET Framework与.NET Framework SDK有什么不同?
  • .NET Remoting Basic(10)-创建不同宿主的客户端与服务器端
  • .NET 常见的偏门问题
  • .NET 动态调用WebService + WSE + UsernameToken
  • .NetCore 如何动态路由
  • @Bean注解详解
  • @ResponseBody
  • [AR]Vumark(下一代条形码)
  • [Assignment] C++1