这里只写了一些核心的代码,具体如下:

Ext.ux.EasyGrid = Ext.extend(Ext.grid.GridPanel, {
initComponent: function () {
this.autoHeight = true,
this.viewConfig = {
forceFit: true
};
this.createStore(); //创建Store
this.createColumns; //创建列模型
this.createTbar(); //创建GridPanel头部的工具栏
this.createBbar(); //创建GridPanel尾部的状态栏 //父类的构造函数 Ext.ux.EasyGrid.superclass.initComponent.call(this); }, createStore: function () {
//二维数组
//代理
var proxy = new Ext.data.HttpProxy({ url: this.url });
var reader = null;
if (this.type == "array") {
reader = new Ext.data.ArrayReader({ fields: this.fields });
} else {
reader = new Ext.data.JsonReader({ root: "rows" },this.fields);
}
this.store = new Ext.data.Store({
proxy: proxy,
reader: reader,
autoLoad: true
});
}, createColumns: function () {
var cols = [];
for (var i = 0; i < this.fields.length; i++) {
var header = this.headers[i];
var f = this.fields[i];
cols.push({
header: header,
dataIndex:f
});
}
this.colums = cols; }, createTbar: function () {
//配置项为数组 添加 删除修改
this.tbar = new Ext.Toolbar([
{
text: "添加",
iconCls: "x-tbar-add",
//指向当前的方法 ux.EasyGrid 指向不同的方法 careteRecord updateRecord removeRecord
heandler: this.createRecord.createDelegate(this) }, {
text:"修改",
iconCls: "x-tbar-update",
heandler:this.updateRecord.createDelegate(this)
}, {
text: "删除",
iconCls: "x-tbar-del",
heandler:this.removeRecord.createDelegate(this) }
]);
}, createTbar: function () {
//分页
this.bbar = new Ext.PagingToolbar({ store: this.store }); }, createRecord: function () {
this.Action = "create"; //自定义属性,表明是添加操作
this.showWindows(); //窗体显示的方法
var form = this.getForm(); //得到窗体中的Form
form.baseParams = {
create:true
}
//根据json对象自动找表单内容 本身为空 把窗体还原
from.setValues(this.getEmptyRecord())
}, updateRecord:function(){
//行选择模型
var r = this.getSelectedRecord();
if (!r) {
this.Action = "update";
this.showWindows();
//得到当前的Form();
var form = this.getForm();
form.baseParams = {
create: false
};
//把对象加载进去
form.loadRecord(r);
} }, removeRecord: function () {
var r = this.getSelectedRecord();
if (r) {
this.Action = "delete";
Ext.Msg.confirm("OA智能办公系统", "您确认要删除此条记录吗?", function (btn) {
if (btn == "yes") {
try {
this.getStore().remove(r);
if (this.fnDelete) {
this.fnDelete(this.store, r);
}
} catch (e) { } }
});
} }, getSelectedRecord:function() {
var sm = this.getSelectionModel();
if (sm.getCount() == 0) {
Ext.Msg.alert("OA办公系统", "请选择一行");
return false;
} else {
return this.getSelections()[0];
}
}, //得到空的函数
getEmptyRecord: function () {
//空的json对象
var r = {};
for (var i = 0; i < this.fields.length; i++) {
var f = this.fields[i];
//给对象产生属性 并赋值 为空
r[f] = "";
}
return r;
}, submitRecord: function () {
//得到表单的对象
var form = this.getForm();
//得到表单域的值
var values = form.getFieldValues();
//如果为添加
if (form.baseParams.create) {
//得到空的json
var json = this.getEmptyRecord();
for (var name in values) {
json[name] = values[name];
}
var rec = new this.store.recordType(json); //回调函数
try {
this.store.add(rec);
if (this.fnCreate)
{
this.fnCreate(this.store, rec);
}
} catch (e) { } } else {
//得到选择的行
var r = this.getSelectedRecord(); try {
r.beginEdit();
for (var name in values) {
r.set(name, values[name]);
}
r.endEdit();
r.commit();
if (this.fnUpdate) {
this.fnUpdate(this.store, r);
}
} catch (e) { } }
this.hideWindow();
}, //得到Panel中的方法
getForm: function () {
//得到当前的表单对象
return this.getFormPanel().getForm();
}, getFormPanel: function () {
if (!this.gridForm) {
//不存在创建一个
this.gridForm = this.createForm();
//存在就直接返回
return this.gridForm;
}
}, //创建一个窗体的按钮
createForm:function(){
var items = [];
for (var i = 0; i < this.headers.length; i++) {
var header = this.headers[i];
var f = this.fields[i];
//构造json对象
item.push({
fieldLabel: header,
name: f
});
} //进行保存
var form = new Ext.form.FormPanel({
frame: true,
defaultType: "textfield",
buttonAlign: "center",
labelAlign: "right",
labelWidth: 70, items: items,
buttons: [
{
text: "提交",
hendler: function () {
//指向当前的对象
this.submitRecord.createDelegate(this);
} }, {
text: "重置",
hendler: function () {
form.getForm().reset();
}
}]
});
return form;
}, showWindows: function () {
this.getWindow().show();
}, hideWindow:function(){
this.getWindow().hide();
}, getWindow:function(){
if (!this.gridWindow) {
this.gridWindow = this.createWindow();
}
return this.gridWindow;
}, createWindow: function () {
var formPanel = this.getFormPanel();
var win = new Ext.Window({
title: "OA办公系统",
width: eval("this.subFormConfig." + this.Action + ".width"),
autoHeight: true,
closeAction: "hide",
modal: true,
items: [formPanel]
});
return win;
} });

改进后的代码:

Ext.ux.EasyGrid = Ext.extend(Ext.grid.GridPanel, {
initComponent: function() {
//this.autoHeight = true;
//this.stripeRows = true;
this.id = "branchInfoGrid";
this.viewConfig = {
forceFit: true
};
this.Action = "read"; this.createStore();
this.createColumns();
this.createTbar();
this.createBbar(); Ext.ux.EasyGrid.superclass.initComponent.call(this);
}, createStore: function() {
var proxy = new Ext.data.HttpProxy({ url: this.url });
var reader = null;
if (this.type == "array") {
reader = new Ext.data.ArrayReader({
fields: this.fields
});
}
else {
reader = new Ext.data.JsonReader({ root: "rows"
}, this.fields);
}
this.store = new Ext.data.Store({
autoLoad: true,
proxy: proxy,
//proxy: new Ext.data.MemoryProxy(this.data),
reader: reader
});
}, createColumns: function() {
var cols = [];
for (var i = 0; i < this.fields.length; i++) {
var header = this.headers[i];
var f = this.fields[i];
cols.push({
header: header,
dataIndex: f
});
} for (var j = 0; j < this.fields.length; j++) {
if (this.colhidden) { //检测并设置列隐藏
if (this.colhidden.indexOf(j) != -1) {
cols[j].hidden = true;
};
}
if (this.renderer) {//检测并设置列renderer
var index = this.renderer.ids.indexOf(j);
if (index != -1) {
cols[j].renderer = this.renderer.funcs[index];
}
} } this.columns = cols;
}, createTbar: function() {
this.tbar = new Ext.Toolbar([{
text: "添加",
iconCls: 'x-tbar-add',
handler: this.createRecord.createDelegate(this)
}, {
text: "修改",
iconCls: 'x-tbar-update',
handler: this.updateRecord.createDelegate(this)
}, {
text: "删除",
iconCls: 'x-tbar-del',
handler: this.removeRecord.createDelegate(this)
}]);
}, createBbar: function() {
this.bbar = new Ext.PagingToolbar({
store: this.store
});
}, createRecord: function() {
this.Action = "create";
this.showWindow();
var form = this.getForm();
form.baseParams = {
create: true
};
form.setValues(this.getEmptyRecord()); }, updateRecord: function() {
var r = this.getSelectedRecord();
if (r != false) {
this.Action = "update";
this.showWindow();
var form = this.getForm();
form.baseParams = {
create: false
}; form.loadRecord(r); if (this.fnWinModify) {
//var _form = win.getComponent("EasyGridForm");
this.fnWinModify(form, r);
}
}
}, removeRecord: function() {
var r = this.getSelectedRecord();
if (r != false) {
this.Action = "delete";
Ext.Msg.confirm('OA智能办公系统', '你确定要删除吗?', function(btn) {
if (btn == 'yes') {
try { if (this.fnDelete) {
this.fnDelete(this.store, r);
}
} catch (ex)
{ }
}
}, this); }
}, getSelectedRecord: function() {
var sm = this.getSelectionModel();
if (sm.getCount() == 0) {
Ext.Msg.alert('OA智能办公系统', '请选择一行!');
return false;
} else {
return sm.getSelections()[0];
}
}, getEmptyRecord: function() {
var r = {};
for (var i = 0; i < this.fields.length; i++) {
var f = this.fields[i];
r[f] = '';
}
return r;
}, submitRecord: function() {
var form = this.getForm();
var values = form.getFieldValues();
if (form.baseParams.create) {
// var data = [];
// for (var name in values) {
// data.push(values[name]);
// }
// this.store.loadData([data], true);
var json = this.getEmptyRecord();
for (var name in values) {
json[name] = values[name];
}
var rec = new this.store.recordType(json);
try { if (this.fnCreate) {
this.fnCreate(this.store,form, rec);
} } catch (ex) { } } else {
var r = this.getSelectedRecord();
try { if (this.fnUpdate) {
this.fnUpdate(form, r,values);
}
} catch (ex)
{ }
}
this.hideWindow();
}, getForm: function() {
return this.getFormPanel().getForm();
}, getFormPanel: function() {
if (!this.gridForm) {
this.gridForm = this.createForm();
}
return this.gridForm;
}, createForm: function() {
var items = [];
for (var i = 0; i < this.headers.length; i++) {
var header = this.headers[i];
var f = this.fields[i];
items.push({
fieldLabel: header,
name: f
});
}
//add by fwy
for (var j = 0; j < this.fields.length; j++) {
if (this.colhidden) { //检测并设置列隐藏
if (this.colhidden.indexOf(j) != -1) {
items[j].hidden = true;
items[j].hideLabel = true;
};
}
if (this.subFormConfig.create.items) {//检测并设置列替换
var index = this.subFormConfig.create.items.ids.indexOf(j);
if (index != -1) {
items[j] = this.subFormConfig.create.items.fields[index];
}
}
} var form = new Ext.form.FormPanel({
frame: true,
id: "EasyGridForm",
defaultType: 'textfield',
buttonAlign: 'center',
labelAlign: 'right',
labelWidth: 130,
trackResetOnLoad: true,
style: "text-align:center",
defaults: { width: 150 }, reader: new Ext.data.ArrayReader({
fields: this.fields
}),
items: items,
buttons: [{
text: '提交',
handler: this.submitRecord.createDelegate(this)
}, {
text: '重置',
handler: function() {
form.getForm().reset();
}
}]
});
return form;
}, showWindow: function() {
this.getWindow().show();
}, hideWindow: function() {
this.getWindow().hide();
}, getWindow: function() {
if (!this.gridWindow) {
this.gridWindow = this.createWindow();
}
var title = eval("this.subFormConfig." + this.Action + ".title");
this.gridWindow.setTitle(title);
return this.gridWindow;
}, createWindow: function() {
var formPanel = this.getFormPanel(); var win = new Ext.Window({
title: 'OA智能办公系统',
width: eval("this.subFormConfig." + this.Action + ".width"),
autoHeight: true,
closeAction: 'hide',
modal: true,
items: [
formPanel
]
}); return win;
}
});

调用时的配置格式:

var branchInfoGrid = new Ext.ux.BranchInfoGrid({
title: 'EasyGrid',
width: 400,
url: "/Web/Manage/DeskTop/JSON/GetBranchInfo.aspx?act=read",
type: "json",
header: false,
headerAsText: false,
height: 400,
fnCreate: fnCreate,
fnUpdate: fnUpdate,
fnDelete: fnDelete,
fnWinModify: fnWinModify,
subFormConfig: { create: { width: 400, height: 300, title: "添加数据", items: { ids: [5], fields: [cbxLeader]} }, read: { width: 300, height: 200, title: "查看数据" }, update: { width: 400, height: 300, title: "修改数据"} },
fields: ['Id', 'BranchName', 'BranchAddr', 'BranchPhone', 'BranchUrl', 'BranchMaster'],
headers: ['ID', '机构名称', '住址', '联系电话', '网址', '负责人'],
colhidden: [0],
renderer: { ids: [5,1], funcs: [renderBranchMaster,renderBranchName] }

this.updatExt.ux.EasyGrid = Ext.extend(Ext.grid.GridPanel, {     initComponent: function () {         this.autoHeight = true,         this.viewConfig = {             forceFit: true         };         this.createStore();  //创建Store         this.createColumns;   //创建列模型         this.createTbar();  //创建GridPanel头部的工具栏         this.createBbar();   //创建GridPanel尾部的状态栏         //父类的构造函数             Ext.ux.EasyGrid.superclass.initComponent.call(this);            },     createStore: function () {         //二维数组         //代理         var proxy = new Ext.data.HttpProxy({ url: this.url });         var reader = null;         if (this.type == "array") {             reader = new Ext.data.ArrayReader({ fields: this.fields });         } else {             reader = new Ext.data.JsonReader({ root: "rows" },this.fields);         }         this.store = new Ext.data.Store({             proxy: proxy,             reader: reader,             autoLoad: true         });     },     createColumns: function () {         var cols = [];         for (var i = 0; i < this.fields.length; i++) {             var header = this.headers[i];             var f = this.fields[i];             cols.push({                 header: header,                 dataIndex:f              });             }         this.colums = cols;     },     createTbar: function () {         //配置项为数组  添加  删除修改         this.tbar = new Ext.Toolbar([             {                 text: "添加",                 iconCls: "x-tbar-add",                 //指向当前的方法 ux.EasyGrid  指向不同的方法 careteRecord  updateRecord  removeRecord                 heandler: this.createRecord.createDelegate(this)             }, {                 text:"修改",                 iconCls: "x-tbar-update",                 heandler:this.updateRecord.createDelegate(this)             }, {                 text: "删除",                 iconCls: "x-tbar-del",                 heandler:this.removeRecord.createDelegate(this)             }         ]);     },     createTbar: function () {         //分页         this.bbar = new Ext.PagingToolbar({ store: this.store });     },     createRecord: function () {         this.Action = "create"; //自定义属性,表明是添加操作         this.showWindows();  //窗体显示的方法         var form = this.getForm();  //得到窗体中的Form         form.baseParams = {             create:true         }           //根据json对象自动找表单内容  本身为空  把窗体还原         from.setValues(this.getEmptyRecord())     },     updateRecord:function(){         //行选择模型         var r = this.getSelectedRecord();         if (!r) {             this.Action = "update";             this.showWindows();             //得到当前的Form();             var form = this.getForm();             form.baseParams = {                 create: false             };             //把对象加载进去             form.loadRecord(r);         }      },     removeRecord: function () {         var r = this.getSelectedRecord();         if (r) {             this.Action = "delete";             Ext.Msg.confirm("OA智能办公系统", "您确认要删除此条记录吗?", function (btn) {                 if (btn == "yes") {                     try {                         this.getStore().remove(r);                         if (this.fnDelete) {                             this.fnDelete(this.store, r);                         }                     } catch (e) {                     }                                     }             });         }              },     getSelectedRecord:function() {         var sm = this.getSelectionModel();         if (sm.getCount() == 0) {             Ext.Msg.alert("OA办公系统", "请选择一行");             return false;         } else {             return this.getSelections()[0];         }     },     //得到空的函数     getEmptyRecord: function () {         //空的json对象         var r = {};         for (var i = 0; i < this.fields.length; i++) {             var f = this.fields[i];             //给对象产生属性  并赋值 为空             r[f] = "";         }         return r;     },     submitRecord: function () {         //得到表单的对象         var form = this.getForm();         //得到表单域的值         var values = form.getFieldValues();         //如果为添加         if (form.baseParams.create) {             //得到空的json             var json = this.getEmptyRecord();             for (var name in values) {                 json[name] = values[name];             }             var rec = new this.store.recordType(json);             //回调函数             try {                 this.store.add(rec);                 if (this.fnCreate)                 {                     this.fnCreate(this.store, rec);                 }             } catch (e) {             }                     } else {             //得到选择的行             var r = this.getSelectedRecord();             try {                 r.beginEdit();                 for (var name in values) {                     r.set(name, values[name]);                 }                 r.endEdit();                 r.commit();                 if (this.fnUpdate) {                     this.fnUpdate(this.store, r);                 }             } catch (e) {             }                     }         this.hideWindow();     },     //得到Panel中的方法     getForm: function () {         //得到当前的表单对象         return this.getFormPanel().getForm();     },     getFormPanel: function () {         if (!this.gridForm) {             //不存在创建一个             this.gridForm = this.createForm();             //存在就直接返回             return this.gridForm;         }     },     //创建一个窗体的按钮     createForm:function(){         var items = [];         for (var i = 0; i < this.headers.length; i++) {             var header = this.headers[i];             var f = this.fields[i];             //构造json对象             item.push({                 fieldLabel: header,                 name: f             });         }         //进行保存         var form = new Ext.form.FormPanel({             frame: true,             defaultType: "textfield",             buttonAlign: "center",             labelAlign: "right",             labelWidth: 70,             items: items,             buttons: [             {                 text: "提交",                 hendler: function () {                     //指向当前的对象                     this.submitRecord.createDelegate(this);                 }             }, {                 text: "重置",                 hendler: function () {                     form.getForm().reset();                 }             }]         });         return form;     },         showWindows: function () {         this.getWindow().show();     },     hideWindow:function(){         this.getWindow().hide();     },     getWindow:function(){         if (!this.gridWindow) {             this.gridWindow = this.createWindow();         }         return this.gridWindow;     },     createWindow: function () {         var formPanel = this.getFormPanel();         var win = new Ext.Window({             title: "OA办公系统",             width: eval("this.subFormConfig." + this.Action + ".width"),             autoHeight: true,             closeAction: "hide",             modal: true,             items: [formPanel]         });         return win;     } });ecord.createDelegate(this)
            }, {
                text: "删除",
                iconCls: "x-tbar-del",
                heandler:this.removeRecord.createDelegate(this)             }
        ]);
    },     createTbar: function () {
        //分页
        this.bbar = new Ext.PagingToolbar({ store: this.store });     },     createRecord: function () {
        this.Action = "create"; //自定义属性,表明是添加操作
        this.showWindows();  //窗体显示的方法
        var form = this.getForm();  //得到窗体中的Form
        form.baseParams = {
            create:true
        }  
        //根据json对象自动找表单内容  本身为空  把窗体还原
        from.setValues(this.getEmptyRecord())
    },     updateRecord:function(){
        //行选择模型
        var r = this.getSelectedRecord();
        if (!r) {
            this.Action = "update";
            this.showWindows();
            //得到当前的Form();
            var form = this.getForm();
            form.baseParams = {
                create: false
            };
            //把对象加载进去
            form.loadRecord(r);
        }      },     removeRecord: function () {
        var r = this.getSelectedRecord();
        if (r) {
            this.Action = "delete";
            Ext.Msg.confirm("OA智能办公系统", "您确认要删除此条记录吗?", function (btn) {
                if (btn == "yes") {
                    try {
                        this.getStore().remove(r);
                        if (this.fnDelete) {
                            this.fnDelete(this.store, r);
                        }
                    } catch (e) {                     }
                   
                }
            });
        }
             },     getSelectedRecord:function() {
        var sm = this.getSelectionModel();
        if (sm.getCount() == 0) {
            Ext.Msg.alert("OA办公系统", "请选择一行");
            return false;
        } else {
            return this.getSelections()[0];
        }
    },     //得到空的函数
    getEmptyRecord: function () {
        //空的json对象
        var r = {};
        for (var i = 0; i < this.fields.length; i++) {
            var f = this.fields[i];
            //给对象产生属性  并赋值 为空
            r[f] = "";
        }
        return r;
    },     submitRecord: function () {
        //得到表单的对象
        var form = this.getForm();
        //得到表单域的值
        var values = form.getFieldValues();
        //如果为添加
        if (form.baseParams.create) {
            //得到空的json
            var json = this.getEmptyRecord();
            for (var name in values) {
                json[name] = values[name];
            }
            var rec = new this.store.recordType(json);             //回调函数
            try {
                this.store.add(rec);
                if (this.fnCreate)
                {
                    this.fnCreate(this.store, rec);
                }
            } catch (e) {             }            
        } else {
            //得到选择的行
            var r = this.getSelectedRecord();             try {
                r.beginEdit();
                for (var name in values) {
                    r.set(name, values[name]);
                }
                r.endEdit();
                r.commit();
                if (this.fnUpdate) {
                    this.fnUpdate(this.store, r);
                }
            } catch (e) {             }
           
        }
        this.hideWindow();
    },     //得到Panel中的方法
    getForm: function () {
        //得到当前的表单对象
        return this.getFormPanel().getForm();
    },     getFormPanel: function () {
        if (!this.gridForm) {
            //不存在创建一个
            this.gridForm = this.createForm();
            //存在就直接返回
            return this.gridForm;
        }
    },     //创建一个窗体的按钮
    createForm:function(){
        var items = [];
        for (var i = 0; i < this.headers.length; i++) {
            var header = this.headers[i];
            var f = this.fields[i];
            //构造json对象
            item.push({
                fieldLabel: header,
                name: f
            });
        }         //进行保存
        var form = new Ext.form.FormPanel({
            frame: true,
            defaultType: "textfield",
            buttonAlign: "center",
            labelAlign: "right",
            labelWidth: 70,             items: items,
            buttons: [
            {
                text: "提交",
                hendler: function () {
                    //指向当前的对象
                    this.submitRecord.createDelegate(this);
                }             }, {
                text: "重置",
                hendler: function () {
                    form.getForm().reset();
                }
            }]
        });
        return form;
    },         showWindows: function () {
        this.getWindow().show();
    },     hideWindow:function(){
        this.getWindow().hide();
    },     getWindow:function(){
        if (!this.gridWindow) {
            this.gridWindow = this.createWindow();
        }
        return this.gridWindow;
    },     createWindow: function () {
        var formPanel = this.getFormPanel();
        var win = new Ext.Window({
            title: "OA办公系统",
            width: eval("this.subFormConfig." + this.Action + ".width"),
            autoHeight: true,
            closeAction: "hide",
            modal: true,
            items: [formPanel]
        });
        return win;
    } });
var i = 0; i < this.fields.length; i++) { var f = this.fields[i]; //给对象产生属性 并赋值 为空 r[f] = ""; } return r; }, submitRecord: function () { //得到表单的对象 var form = this.getForm(); //得到表单域的值 var values = form.getFieldValues(); //如果为添加 if (form.baseParams.create) { //得到空的json var json = this.getEmptyRecord(); for (var name in values) { json[name] = values[name]; } var rec = new this.store.recordType(json); //回调函数 try { this.store.add(rec); if (this.fnCreate) { this.fnCreate(this.store, rec); } } catch (e) { } } else { //得到选择的行 var r = this.getSelectedRecord(); try { r.beginEdit(); for (var name in values) { r.set(name, values[name]); } r.endEdit(); r.commit(); if (this.fnUpdate) { this.fnUpdate(this.store, r); } } catch (e) { } } this.hideWindow(); }, //得到Panel中的方法 getForm: function () { //得到当前的表单对象 return this.getFormPanel().getForm(); }, getFormPanel: function () { if (!this.gridForm) { //不存在创建一个 this.gridForm = this.createForm(); //存在就直接返回 return this.gridForm; } }, //创建一个窗体的按钮 createForm:function(){ var items = []; for (var i = 0; i < this.headers.length; i++) { var header = this.headers[i]; var f = this.fields[i]; //构造json对象 item.push({ fieldLabel: header, name: f }); } //进行保存 var form = new Ext.form.FormPanel({ frame: true, defaultType: "textfield", buttonAlign: "center", labelAlign: "right", labelWidth: 70, items: items, buttons: [ { text: "提交", hendler: function () { //指向当前的对象 this.submitRecord.createDelegate(this); } }, { text: "重置", hendler: function () { form.getForm().reset(); } }] }); return form; }, showWindows: function () { this.getWindow().show(); }, hideWindow:function(){ this.getWindow().hide(); }, getWindow:function(){ if (!this.gridWindow) { this.gridWindow = this.createWindow(); } return this.gridWindow; }, createWindow: function () { var formPanel = this.getFormPanel(); var win = new Ext.Window({ title: "OA办公系统", width: eval("this.subFormConfig." + this.Action + ".width"), autoHeight: true, closeAction: "hide", modal: true, items: [formPanel] }); return win; } }二:Ext.get()和Ext.fly()之区别:

1.Ext.Element是Ext对Dom元素的一个强有力封装,它封装了很多方便对dom操作的接口

2.Ext.get和Ext.fly返回的都是一个Element对象,但是Ext.get返回的是一个独立的Element,拥有自己独立的操作接口

三:设置日期的格式的方法:

一:格式化当前的额时间格式:
var task={
run:function(){
Ext.fly('clock').update(new Date().format("g:i:s"));
}
interval:1000
} 二:开启用行的格式:
var runner=new Ext.util.TaskRunner(); //定时执行任务(该类可以保障每一个任务或服务都可以在任何时刻独立的运行,而不会影响其他的任务或服务的运行)
runner.start(task);

Ext.js中自己扩展的EasyGrid的更多相关文章

  1. Ext JS中Button的一般使用

    Ext JS中Button按钮的显示,以及按钮的部分事件 一.属性 renderTo:将当前对象所生成的HTML对象存放在指定的对象中 text:得到按钮名称 minWidth:按钮最小宽度 hidd ...

  2. Ext JS中的typeOf

    Ext JS中的typeOf:以字符串格式,返回给定变量的类型 其中对字符串对象.元素节点.文本节点.空白文本节点判断并不准确 测试代码如下: <!DOCTYPE HTML PUBLIC &qu ...

  3. 【翻译】在Ext JS中创建特定主题的重写

    Ext JS提供了大量的功能来使类的创建和处理变得简单,还提供了一系列的功能来扩展和重新现有的Javascript类.这意味着可以为类添加行为和创建属于自己的类,或者重写某些函数的行为.在本文,将展示 ...

  4. sencha touch/Ext Js 6 + 自定义扩展的用法

    app.js中加入以下代码 //指定ux起调目录 Ext.Loader.setPath({ 'ux': 'app/ux' }); 在app目录中创建一个ux文件夹 假如我们使用这个扩展,扩展地址:ht ...

  5. Ext.js中的tip事件实际使用

    Ext.onReady(function () { // Init the singleton. Any tag-based quick tips will start working. Ext.ti ...

  6. Ext js中CheckBoxGroup的动态绑定

    <script type="text/jscript"> var WinXianCode; function SearchGetXianLuF(Type) { if(! ...

  7. Ext.js 中 25种类型的Ext.panel.Tool

    通过Ext.panel.Panel的tools配置项来设置Ext.panel.Tool实例. 要注意的一点是,Ext框架提供的Ext.panel.Tool仅包含按钮图标而具体的点击事件处理函数需要我们 ...

  8. Ext.js中树勾选的四种操作

    最近在做控件优化的时候产品提了一个需求,对树的勾选要满足四种勾选方案: 1.点击一次根节点,当根节点和子节点均未选中的情况下,根节点和子节点全都选中. 2.第二次点击根节点,当根节点和部分或全部子节点 ...

  9. 【翻译】在Ext JS和Sencha Touch中创建自己定义布局

    原文:Creating Custom Layouts in Ext JS and Sencha Touch 布局系统是Sencha框架中最强大和最独特的一部分.布局会处理应用程序中每个组件的大小和位置 ...

随机推荐

  1. golang变量声明

    func main() { var a1 int a1 = 1 var a = 1 b := 1 var c, d int c = 1 d = 1 var e, f = 1, 2 g, h := 1, ...

  2. 浅谈cookie与session的区别

    cookie用的是在客户端保持状态的方案(它是在用户端的会话状态的存贮机制),前端也可以来设置他 所有浏览器都识别,并且会缓存在浏览器中. cookie是以key=value这种键值对的形式保存,每个 ...

  3. ettercap插件介绍

    利用sslstrip和ettercap突破ssl嗅探密码 ettercap之DNS欺骗--结合metasploit使用 ettercap支持在运行时加载模块.它们会自动地编译你的系统是否支持他们或者直 ...

  4. 20155319 2016-2017-2 《Java程序设计》第八周学习总结

    20155319 2016-2017-2 <Java程序设计>第八周学习总结 教材学习内容总结 NIO与NIO2 - NIO使用频道(channel)来衔接数据节点 - read()将Re ...

  5. JavaScript之this,call,apply

    this:被调用的上下文对象: apply与call:切换被调用的上下文对象,即 调用时,this被临时性地切换 //demo 1 [call] function forEach(list,callb ...

  6. MySQL5.7使用错误解决:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)【取消或重设root密码】

    解决方法: 最简单方法: ⑴打开mysql中的my.ini(如果没有就将my-default.ini复制一份,并修改为my.ini): ⑵在[mysqld]下面空白行直接添加skip-grant-ta ...

  7. 论文笔记系列-Neural Architecture Search With Reinforcement Learning

    摘要 神经网络在多个领域都取得了不错的成绩,但是神经网络的合理设计却是比较困难的.在本篇论文中,作者使用 递归网络去省城神经网络的模型描述,并且使用 增强学习训练RNN,以使得生成得到的模型在验证集上 ...

  8. 实用技能之Python打包制作成EXE可执行程序

    制作环境:Andconda3,python3.6 一.安装pyInstaller 方式一): 在命令行输入:pip install pyinstaller 方式二): ①   下载pyInstalle ...

  9. JS实现随机背景图片与图片大小变换的效果

    经常在网上见一些网站访问一次背景图片改变一次,而且图片的大小不停变换,于是想着自己研究一下. 背景图片可以通过JS的随机数来改变图片的src来实现随机图片,图片的大小变换可以用JS的setInterv ...

  10. oracle新建对象 权限管理

    代码 CREATE USER target IDENTIFIED BY target ; GRANT CONNECT, RESOURCE TO target; 刚刚创建的oracle实例中会内建两个用 ...