zoukankan      html  css  js  c++  java
  • Extjs4.2 多选下拉框

    //多选下拉框
    Ext.define('MDM.view.custom.MultiComboBox', {
        extend: 'Ext.form.ComboBox',
        alias: 'widget.multicombobox',
        xtype: 'multicombobox',
        initComponent: function() {
            this.multiSelect = true;
            this.listConfig = {
                itemTpl: Ext.create('Ext.XTemplate',
    '<input type=checkbox>{' + this.displayField + '}'),
                onItemSelect: function(record) {
                    var node = this.getNode(record);
                    var count = this.getStore().data.length;
                    if (node) {
                        Ext.fly(node).addCls(this.selectedItemCls);
                        var checkboxs = node.getElementsByTagName("input");
                        if (checkboxs != null) {
                            var checkbox = checkboxs[0];
                            checkbox.checked = true;
                        }
                    }
                },
                onItemDeselect: function(record) {
                var node = this.getNode(record);
                var count = this.getStore().data.length;
                if (node) {
                    Ext.fly(node).removeCls(this.selectedItemCls);
                    var checkboxs = node.getElementsByTagName("input");
                    if (checkboxs != null) {
                        var checkbox = checkboxs[0];
                        checkbox.checked = false;
                    }
                }
                },
                listeners: {
                    itemclick: function(view, record, item, index, e, eOpts) {
                        var isSelected = view.isSelected(item);
                        var checkboxs = item.getElementsByTagName("input");
                        if (checkboxs != null) {
                            var checkbox = checkboxs[0];
                            if (!isSelected) {
                                checkbox.checked = true;
                            } else {
                                checkbox.checked = false;
                            }
                        }
                    }
                }
            }
            this.callParent();
        }
    });
    

      

  • 相关阅读:
    Python之禅
    浅析css布局模型1
    原型与继承学习笔记4
    原型与继承学习笔记3
    原型与继承学习笔记1
    javascript-this,call,apply,bind简述3
    javascript-this,call,apply,bind简述2
    javascript-this,call,apply,bind简述1
    javascript数组浅谈3
    javascript数组浅谈2
  • 原文地址:https://www.cnblogs.com/hetaojs/p/5760435.html
Copyright © 2011-2022 走看看