체크 상자가 있고 검색 기능을 지원하는 드롭다운 목록 7

4396 단어 드롭다운 목록

// private
    onSelect : function(record, index)
    {
        /*
         *  ,ckf36476
         */
        if (index == 0)
        {
            var r_qx = this.store.getAt(index);
            var newValue_qx = r_qx.data[this.displayField];
            var check_qx = document.getElementById("checkBox_" + newValue_qx);
            if (check_qx.className == "checked")
            {
                check_qx.className = "unchecked"
            }
            else
            {
                check_qx.className = "checked"
            }
            for (var i = 1; i < this.store.data.length; i++)
            {
                var r = this.store.getAt(i);
                var newValue = r.data[this.displayField];
                var check = document.getElementById("checkBox_" + newValue);
                if (check_qx.className == "checked")
                {
                    check.className = "checked"
                }
                else
                {
                    check.className = "unchecked"
                }
            }
            var value = "";
            var hiddenValue = "";
            for (var i = 0; i < this.store.data.length; i++)
            {
                var r = this.store.getAt(i);
                newValue = r.data[this.displayField];
                check = document.getElementById("checkBox_" + newValue);
                if (check.className == "checked")
                {
                    value += r.data[this.displayField] + this.displaySeparator;
                    hiddenValue += r.data[this.valueField] + this.valueSeparator;
                }
            }
            if (value.length > 1)
            {
                value = value.substring(0, value.length - this.displaySeparator.length);
            }
            if (hiddenValue.length > 1)
            {
                hiddenValue = hiddenValue.substring(0, value.length - this.valueSeparator.length);
            }
            this.setValue(value);
            this.hiddenField.value = hiddenValue;
            this.fireEvent('select', this, record, index);
            return;
        }
        // 


        if (this.fireEvent('beforeselect', this, record, index) !== false)
        {
            var r = this.store.getAt(index);
            var newValue = r.data[this.displayField];
            var check = document.getElementById("checkBox_" + newValue);
            if (check.className == "checked")
            {
                check.className = "unchecked"
            }
            else
            {
                check.className = "checked"
            }
            var value = "";
            var hiddenValue = "";
            for (var i = 0; i < this.store.data.length; i++)
            {
                var r = this.store.getAt(i);
                newValue = r.data[this.displayField];
                check = document.getElementById("checkBox_" + newValue);
                if (check.className == "checked")
                {
                    value += r.data[this.displayField] + this.displaySeparator;
                    hiddenValue += r.data[this.valueField] + this.valueSeparator;
                }
            }
            if (value.length > 1)
            {
                value = value.substring(0, value.length - this.displaySeparator.length);
            }
            if (hiddenValue.length > 1)
            {
                hiddenValue = hiddenValue.substring(0, value.length - this.valueSeparator.length);
            }
            this.setValue(value);
            this.hiddenField.value = hiddenValue;
            this.fireEvent('select', this, record, index);
        }
    },

좋은 웹페이지 즐겨찾기