⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form-debug.js

📁 最强的js界面,超前卫的显示方式 把AJAX运用得淋漓尽致。
💻 JS
📖 第 1 页 / 共 5 页
字号:
                this.select(this.selectedIndex-1);            }        }    },        onKeyUp : function(e){        if(this.editable !== false && !e.isSpecialKey()){            this.lastKey = e.getKey();            this.dqTask.delay(this.queryDelay);        }    },        validateBlur : function(){        return !this.list || !this.list.isVisible();    },        initQuery : function(){        this.doQuery(this.getRawValue());    },        doForce : function(){        if(this.el.dom.value.length > 0){            this.el.dom.value =                this.lastSelectionText === undefined ? '' : this.lastSelectionText;            this.applyEmptyText();        }    },        doQuery : function(q, forceAll){        if(q === undefined || q === null){            q = '';        }        var qe = {            query: q,            forceAll: forceAll,            combo: this,            cancel:false        };        if(this.fireEvent('beforequery', qe)===false || qe.cancel){            return false;        }        q = qe.query;        forceAll = qe.forceAll;        if(forceAll === true || (q.length >= this.minChars)){            if(this.lastQuery !== q){                this.lastQuery = q;                if(this.mode == 'local'){                    this.selectedIndex = -1;                    if(forceAll){                        this.store.clearFilter();                    }else{                        this.store.filter(this.displayField, q);                    }                    this.onLoad();                }else{                    this.store.baseParams[this.queryParam] = q;                    this.store.load({                        params: this.getParams(q)                    });                    this.expand();                }            }else{                this.selectedIndex = -1;                this.onLoad();            }        }    },        getParams : function(q){        var p = {};                if(this.pageSize){            p.start = 0;            p.limit = this.pageSize;        }        return p;    },        collapse : function(){        if(!this.isExpanded()){            return;        }        this.list.hide();        Ext.getDoc().un('mousewheel', this.collapseIf, this);        Ext.getDoc().un('mousedown', this.collapseIf, this);        this.fireEvent('collapse', this);    },        collapseIf : function(e){        if(!e.within(this.wrap) && !e.within(this.list)){            this.collapse();        }    },        expand : function(){        if(this.isExpanded() || !this.hasFocus){            return;        }        this.list.alignTo(this.wrap, this.listAlign);        this.list.show();        this.innerList.setOverflow('auto');         Ext.getDoc().on('mousewheel', this.collapseIf, this);        Ext.getDoc().on('mousedown', this.collapseIf, this);        this.fireEvent('expand', this);    },            onTriggerClick : function(){        if(this.disabled){            return;        }        if(this.isExpanded()){            this.collapse();            this.el.focus();        }else {            this.onFocus({});            if(this.triggerAction == 'all') {                this.doQuery(this.allQuery, true);            } else {                this.doQuery(this.getRawValue());            }            this.el.focus();        }    }                });Ext.reg('combo', Ext.form.ComboBox);Ext.Editor = function(field, config){    this.field = field;    Ext.Editor.superclass.constructor.call(this, config);};Ext.extend(Ext.Editor, Ext.Component, {                        value : "",        alignment: "c-c?",        shadow : "frame",        constrain : false,        swallowKeys : true,        completeOnEnter : false,        cancelOnEsc : false,        updateEl : false,    initComponent : function(){        Ext.Editor.superclass.initComponent.call(this);        this.addEvents(                        "beforestartedit",                        "startedit",                        "beforecomplete",                        "complete",                        "specialkey"        );    },        onRender : function(ct, position){        this.el = new Ext.Layer({            shadow: this.shadow,            cls: "x-editor",            parentEl : ct,            shim : this.shim,            shadowOffset:4,            id: this.id,            constrain: this.constrain        });        this.el.setStyle("overflow", Ext.isGecko ? "auto" : "hidden");        if(this.field.msgTarget != 'title'){            this.field.msgTarget = 'qtip';        }        this.field.inEditor = true;        this.field.render(this.el);        if(Ext.isGecko){            this.field.el.dom.setAttribute('autocomplete', 'off');        }        this.field.on("specialkey", this.onSpecialKey, this);        if(this.swallowKeys){            this.field.el.swallowEvent(['keydown','keypress']);        }        this.field.show();        this.field.on("blur", this.onBlur, this);        if(this.field.grow){            this.field.on("autosize", this.el.sync,  this.el, {delay:1});        }    },    onSpecialKey : function(field, e){        if(this.completeOnEnter && e.getKey() == e.ENTER){            e.stopEvent();            this.completeEdit();        }else if(this.cancelOnEsc && e.getKey() == e.ESC){            this.cancelEdit();        }else{            this.fireEvent('specialkey', field, e);        }    },        startEdit : function(el, value){        if(this.editing){            this.completeEdit();        }        this.boundEl = Ext.get(el);        var v = value !== undefined ? value : this.boundEl.dom.innerHTML;        if(!this.rendered){            this.render(this.parentEl || document.body);        }        if(this.fireEvent("beforestartedit", this, this.boundEl, v) === false){            return;        }        this.startValue = v;        this.field.setValue(v);        this.doAutoSize();        this.el.alignTo(this.boundEl, this.alignment);        this.editing = true;        this.show();    },        doAutoSize : function(){        if(this.autoSize){            var sz = this.boundEl.getSize();            switch(this.autoSize){                case "width":                    this.setSize(sz.width,  "");                break;                case "height":                    this.setSize("",  sz.height);                break;                default:                    this.setSize(sz.width,  sz.height);            }        }    },        setSize : function(w, h){        delete this.field.lastSize;        this.field.setSize(w, h);        if(this.el){            this.el.sync();        }    },        realign : function(){        this.el.alignTo(this.boundEl, this.alignment);    },        completeEdit : function(remainVisible){        if(!this.editing){            return;        }        var v = this.getValue();        if(this.revertInvalid !== false && !this.field.isValid()){            v = this.startValue;            this.cancelEdit(true);        }        if(String(v) === String(this.startValue) && this.ignoreNoChange){            this.editing = false;            this.hide();            return;        }        if(this.fireEvent("beforecomplete", this, v, this.startValue) !== false){            this.editing = false;            if(this.updateEl && this.boundEl){                this.boundEl.update(v);            }            if(remainVisible !== true){                this.hide();            }            this.fireEvent("complete", this, v, this.startValue);        }    },        onShow : function(){        this.el.show();        if(this.hideEl !== false){            this.boundEl.hide();        }        this.field.show();        if(Ext.isIE && !this.fixIEFocus){             this.fixIEFocus = true;            this.deferredFocus.defer(50, this);        }else{            this.field.focus();        }        this.fireEvent("startedit", this.boundEl, this.startValue);    },    deferredFocus : function(){        if(this.editing){            this.field.focus();        }    },        cancelEdit : function(remainVisible){        if(this.editing){            this.setValue(this.startValue);            if(remainVisible !== true){                this.hide();            }        }    },        onBlur : function(){        if(this.allowBlur !== true && this.editing){            this.completeEdit();        }    },        onHide : function(){        if(this.editing){            this.completeEdit();            return;        }        this.field.blur();        if(this.field.collapse){            this.field.collapse();        }        this.el.hide();        if(this.hideEl !== false){            this.boundEl.show();        }    },        setValue : function(v){        this.field.setValue(v);    },        getValue : function(){        return this.field.getValue();    },    beforeDestroy : function(){        this.field.destroy();        this.field = null;    }});Ext.reg('editor', Ext.Editor);Ext.form.BasicForm = function(el, config){    Ext.apply(this, config);        this.items = new Ext.util.MixedCollection(false, function(o){        return o.id || (o.id = Ext.id());    });    this.addEvents(                'beforeaction',                'actionfailed',                'actioncomplete'    );        if(el){        this.initEl(el);    }    Ext.form.BasicForm.superclass.constructor.call(this);};Ext.extend(Ext.form.BasicForm, Ext.util.Observable, {                                timeout: 30,        activeAction : null,        trackResetOnLoad : false,                    initEl : function(el){        this.el = Ext.get(el);        this.id = this.el.id || Ext.id();        if(!this.standardSubmit){            this.el.on('submit', this.onSubmit, this);        }        this.el.addClass('x-form');    },        getEl: function(){        return this.el;    },        onSubmit : function(e){        e.stopEvent();    },        	destroy: function() {        this.items.each(function(f){            Ext.destroy(f);        });        if(this.el){			this.el.removeAllListeners();			this.el.remove();        }		this.purgeListeners();	},        isValid : function(){        var valid = true;        this.items.each(function(f){           if(!f.validate()){               valid = false;           }        });        return valid;    },        isDirty : function(){        var dirty = false;        this.items.each(function(f){           if(f.isDirty()){               dirty = true;               return false;           }        });        return dirty;    },        doAction : function(action, options){        if(typeof action == 'string'){            action = new Ext.form.Action.ACTION_TYPES[action](this, options);        }        if(this.fireEvent('beforeaction', this, action) !== false){            this.beforeAction(action);            action.run.defer(100, action);        }        return this;    },        submit : function(options){        if(this.standardSubmit){            var v = this.isValid();            if(v){                this.el.dom.submit();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -