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

📄 sync.list.js

📁 echo3 很炫的ajax框架技术 js 演示demo ajax j2ee 里面有jsp演示代码
💻 JS
📖 第 1 页 / 共 2 页
字号:
        var trElement = document.createElement("tr");        tbodyElement.appendChild(trElement);        var tdElement = document.createElement("td");        trElement.appendChild(tdElement);                this._div = document.createElement("div");        tdElement.appendChild(this._div);                this._div.style.cssText = "cursor:default;overflow:auto;";        this._div.style.height = Echo.Sync.Extent.toCssValue(this.component.render("height", "6em"), false, false);        var width = this.component.render("width");        if (!Echo.Sync.Extent.isPercent(width)) {            this._div.style.width = Echo.Sync.Extent.toCssValue(width, true, false);        }        if (this._enabled) {            Echo.Sync.renderComponentDefaults(this.component, this._element);        } else {            Echo.Sync.LayoutDirection.render(this.component.getLayoutDirection(), this._element);            Echo.Sync.Color.render(Echo.Sync.getEffectProperty(this.component, "foreground", "disabledForeground", true),                     this._div, "color");            Echo.Sync.Color.render(Echo.Sync.getEffectProperty(this.component, "background", "disabledBackground", true),                     this._div, "backgroundColor");            Echo.Sync.Font.render(Echo.Sync.getEffectProperty(this.component, "font", "disabledFont", true), this._div);        }        Echo.Sync.Border.render(                Echo.Sync.getEffectProperty(this.component, "border", "disabledBorder", !this._enabled,                 Echo.Sync.ListComponent.DEFAULT_DIV_BORDER, null),                 this._div);        Echo.Sync.Insets.render(this.component.render("insets"), this._div, "padding");        var items = this.component.get("items");        if (items) {            for (var i = 0; i < items.length; ++i) {                var optionElement = document.createElement("div");                if (items[i].text) {                    optionElement.appendChild(document.createTextNode(items[i].text));                } else {                    optionElement.appendChild(document.createTextNode(items[i].toString()));                }                if (items[i].foreground) {                    Echo.Sync.Color.render(items[i].foreground, optionElement, "color");                }                if (items[i].background) {                    Echo.Sync.Color.render(items[i].background, optionElement, "backgroundColor");                }                if (items[i].font) {                    Echo.Sync.Font.render(items[i].font, optionElement);                }                this._div.appendChild(optionElement);            }        }                if (this._enabled) {            Core.Web.Event.add(this._element, "blur", Core.method(this, this._processBlur), false);            Core.Web.Event.add(this._element, "focus", Core.method(this, this._processFocus), false);            Core.Web.Event.add(this._div, "click", Core.method(this, this._processClick), false);            Core.Web.Event.add(this._div, "selectstart", Core.method(this, this._processSelectStart), false);        }                parentElement.appendChild(this._element);    },        /**     * Renders the list selection component as a standard SELECT element.     * This strategy is always used in all browsers except IE6, and is used in IE6     * for drop-down select fields.  IE6 cannot use this strategy for listboxes     * do to major bugs in this browser (listboxes randomly change back into selectfields     * when rendered by DOM manipulation).     * This strategy is used when the _alternateRender flag is false.     *      * @param {Echo.Update.ComponentUpdate} update the update     * @param {Element} parent the parent DOM element      */    _renderMainAsSelect: function(update, parentElement) {        this._div = document.createElement("div");            this._element = document.createElement("select");        this._element.id = this.component.renderId;        this._element.size = this.listBox ? 6 : 1;        if (!this._enabled) {            this._element.disabled = true;        }        if (this._multipleSelect) {            this._element.multiple = "multiple";        }        this._element.style.height = Echo.Sync.Extent.toCssValue(this.component.render("height"), false, false);                var width = this.component.render("width");        if (width) {            if (Echo.Sync.Extent.isPercent(width)) {                if (!Core.Web.Env.QUIRK_IE_SELECT_PERCENT_WIDTH) {                    this._div.style.width = width;                    this._element.style.width = "100%";                }            } else {                this._element.style.width = Echo.Sync.Extent.toCssValue(width, true, false);            }        }        if (this._enabled) {            Echo.Sync.renderComponentDefaults(this.component, this._element);        } else {            Echo.Sync.LayoutDirection.render(this.component.getLayoutDirection(), this._element);            Echo.Sync.Color.render(Echo.Sync.getEffectProperty(this.component, "foreground", "disabledForeground", true),                     this._element, "color");            Echo.Sync.Color.render(Echo.Sync.getEffectProperty(this.component, "background", "disabledBackground", true),                     this._element, "backgroundColor");            Echo.Sync.Font.render(Echo.Sync.getEffectProperty(this.component, "font", "disabledFont", true),this._element);        }        Echo.Sync.Border.render(Echo.Sync.getEffectProperty(this.component, "border", "disabledBorder", !this._enabled),                 this._element);        Echo.Sync.Insets.render(this.component.render("insets"), this._element, "padding");        var items = this.component.get("items");        if (items) {            for (var i = 0; i < items.length; ++i) {                var optionElement = document.createElement("option");                if (items[i].text == null) {                    optionElement.appendChild(document.createTextNode(items[i].toString()));                } else {                    optionElement.appendChild(document.createTextNode(items[i].text));                }                if (items[i].foreground) {                    Echo.Sync.Color.render(items[i].foreground, optionElement, "color");                }                if (items[i].background) {                    Echo.Sync.Color.render(items[i].background, optionElement, "backgroundColor");                }                if (items[i].font) {                    Echo.Sync.Font.render(items[i].font, optionElement);                }                this._element.appendChild(optionElement);            }        }            if (this._enabled) {            Core.Web.Event.add(this._element, "change", Core.method(this, this._processChange), false);            Core.Web.Event.add(this._element, "blur", Core.method(this, this._processBlur), false);            Core.Web.Event.add(this._element, "focus", Core.method(this, this._processFocus), false);        }        this._div.appendChild(this._element);        parentElement.appendChild(this._div);    },    /**     * Renders the current selection state.     */    _renderSelection: function() {        var selection = this._getSelection(),            i;                if (this._alternateRender) {            if (this._hasRenderedSelectedItems) {                var items = this.component.get("items");                for (i = 0; i < items.length; ++i) {                    Echo.Sync.Color.renderClear(items[i].foreground, this._div.childNodes[i],                             "color");                    Echo.Sync.Color.renderClear(items[i].background, this._div.childNodes[i],                             "backgroundColor");                }            }            if (selection instanceof Array) {                for (i = 0; i < selection.length; ++i) {                    if (selection[i] >= 0 && selection[i] < this._div.childNodes.length) {                        Echo.Sync.Color.render(Echo.Sync.ListComponent.DEFAULT_SELECTED_FOREGROUND,                                this._div.childNodes[selection[i]], "color");                        Echo.Sync.Color.render(Echo.Sync.ListComponent.DEFAULT_SELECTED_BACKGROUND,                                this._div.childNodes[selection[i]], "backgroundColor");                    }                }            } else if (selection >= 0 && selection < this._div.childNodes.length) {                Echo.Sync.Color.render(Echo.Sync.ListComponent.DEFAULT_SELECTED_FOREGROUND,                        this._div.childNodes[selection], "color");                Echo.Sync.Color.render(Echo.Sync.ListComponent.DEFAULT_SELECTED_BACKGROUND,                        this._div.childNodes[selection], "backgroundColor");            }        } else {            if (this._hasRenderedSelectedItems) {                this._element.selectedIndex = -1;            }            if (selection instanceof Array) {                for (i = 0; i < selection.length; ++i) {                    if (selection[i] >= 0 && selection[i] < this._element.options.length) {                        this._element.options[selection[i]].selected = true;                    }                }            } else if (selection >= 0 && selection < this._element.options.length) {                this._element.options[selection].selected = true;            }        }        this._hasRenderedSelectedItems = true;    },        /** @see Echo.Render.ComponentSync#renderUpdate */    renderUpdate: function(update) {        if (update.getUpdatedProperty("selectedId") && !update.getUpdatedProperty("selection")) {            this._selectedIdPriority = true;        }            var element = this._element;        var containerElement = element.parentNode;        this.renderDispose(update);        containerElement.removeChild(element);        this.renderAdd(update, containerElement);        return false; // Child elements not supported: safe to return false.    },        /**     * Sets the selection state.     * Updates values of both "selection" and "selectedId" properties of the component.     *      * @param selection the new selection state, either the selected index or an array of selected indices      */    _setSelection: function(selection) {        this._selectedIdPriority = false;            var selectedId = null;                if (selection instanceof Array && selection.length == 1) {            selection = selection[0];        }                var items = this.component.get("items");        if (selection instanceof Array) {            selectedId = [];            for (var i = 0; i < selection.length; ++i) {                var selectedIndex = selection[i];                if (selectedIndex < items.length) {                    if (items[selectedIndex].id != null) {                        selectedId.push(items[selectedIndex].id);                    }                }            }        } else {            if (selection < items.length) {                if (items[selection].id != null) {                    selectedId = items[selection].id;                }            }        }        this.component.set("selection", selection);        this.component.set("selectedId", selectedId);    }});/** * Component rendering peer: ListBox */Echo.Sync.ListBox = Core.extend(Echo.Sync.ListComponent, {        /** @see Echo.Sync.ListComponent#listBox */    listBox: true,    $load: function() {        Echo.Render.registerPeer("ListBox", this);    }});/** * Component rendering peer: SelectField */Echo.Sync.SelectField = Core.extend(Echo.Sync.ListComponent, {     /** @see Echo.Sync.ListComponent#listBox */    listBox: false,    $load: function() {        Echo.Render.registerPeer("SelectField", this);    }});

⌨️ 快捷键说明

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