zoukankan      html  css  js  c++  java
  • ExtJs-学习篇(1)

    全局Global.js:

    1.1 一些公用的信息:

        Ext.BLANK_IMAGE_URL="/Web/ext-3.1.0/resources/images/default/s.gif"

    1.2 初始化错误提示:

        Ext.QuickTips.init();

    1.3 统一指定错误信息提示方式:

        Ext.form.Filed.prototype.msgTarget='side';

    1.4 写cookies函数:

        function setCookie(name,value)//一个是cookie的名字,一个是cookie的值

        {

          var Days=30;//表示此cookie将被保存30天

          var exp=new Date();//用于初始化当前的时间,exp.getTime()是获取当前的年月日

          exp.setTime(exp.getTime()+Days*24*60*60*1000);//cookie的失效时间都是以"毫秒"为单位的

         document.cookie=name+"="escape(value)+";expires="+exp.toGMTString();//开始设置cookie的格式,和coookie的失效时间

        }

    1.5 读cookies函数:

         function getCookie(name){

         var arr=document.cookie.match(new RegExp("(^|)"+name+"=([^;]*)(;|$)"));

         if(arr!=null)

              return unescape(arr[2]);

         return null;

       }

    1.6 删除cookie:

          function delCookie(){

          var exp=new Date();

          exp.setTime(exp.getTime()-1);//设置cookie失效时间为当前时间的前一天,说明cookie的有效期是在过去,自然就删除了cookie

          var cval=getCookie(name);//读cookie

           if(cval!=null)//如果有cookie,则设置cookie失效时间

           {

              document.cookie=name+"="+cval+";expires="+exp.toGMTString();

          }

        }

    编写第一个Grid扩展(EasyGrid):

       1,Ext.ux.EasyGrid=Ext.extend(Ext.grid.GridPanel,{

              initComponent:function(){

                 this.autoHeight=true;//自动设置高度;

                 this.viewConfig={

                           forceFit:true//自动填充内容

                   };

                this.Action="read";

                this.createStore();//创建Store

                this.createColumns();//创建列实体(ColModel)

                this.createTbar();//为GridPanel创建头部工具栏

                this.createBbar();//为GridPanel创建尾部工具栏

                Ext.ux.EasyGrid.superClass.initComponent.call(this);//调用父类的构造函数

               },

              createRecord:function(){

                   //添加...

               },

               updateRecord:function(){

                 //修改操作...

              },

              removeRecord:function(){

                //删除操作...

              },

              getSelectedRecord:function(){

                 //得到一个选中行

               },

                getEmptyRecord:function(){

                 //得到一个空的行

                },

    })

  • 相关阅读:
    Shell编程之运算符和环境变量配置文件
    Shell编程之变量
    PCI BAR设置过程[转]
    基于ARM的SoC设计入门[转]
    负载均衡
    [转]vc中调用其他应用程序的方法(函数) winexec,shellexecute ,createprocess
    VC/DDK/DriverWorks开发环境配置
    windows下注册表脚本编写
    _cdecl与_stdcall区别
    在C语言中破坏函数调用堆栈
  • 原文地址:https://www.cnblogs.com/dlf-myDream/p/5224679.html
Copyright © 2011-2022 走看看