单击selectize.js时,下拉菜单自动关闭

时间:2019-04-07 18:07:49

标签: angularjs selectize.js

我想在项目中使用 selectize.js 。除一件事外,其他所有东西都工作正常,当我单击下拉菜单中的滚动条时,它会自动关闭,并且我不知道如何解决此问题,也许我应该在配置中做些事情。有人遇到这个问题吗?

这是我的配置对象:

facility_config = {
                maxItems: 1,
                plugins: ['remove_button'],
                valueField: 'id',
                searchField: ['facility_name'],
                optgroups: [
                    { id: 0, group_name: 'Teams' },
                    { id: 1, group_name: 'Primary Practices' },
                    { id: 2, group_name: 'Facility Affiliations' }
                ],
                optgroupField: 'group_name',
                optgroupValueField: 'group_name',
                optgroupLabelField: 'group_name',
                lockOptgroupOrder: true,
                render: {
                    item: function (item, escape) {
                        return '<div class="option">' +
                        '<span>' + escape(item.facility_name) + '</span>' +
                        '<span ng-if="item.city && item.state">' + ' ( ' + escape(item.city) + ', ' + escape(item.state) + ' )' + '</span>' +
                        '<span class="fa fa-asterisk text-orange"></span>'
                        '</div>';
                    },
                    optgroup_header: function (data, escape) {
                        return '<div class="optgroup-header"><strong>' + escape(data.group_name) + '</strong></div>';
                    },
                    option: function (item, escape) {
                        return '<div class="option">' +
                               '<span>' + escape(item.facility_name) + '</span>' +
                               '<span ng-if="item.city && item.state" class="text-muted">' + ' ( ' + escape(item.city) + ', ' + escape(item.state) + ' )' + '</span>' +
                               '<span class="fa fa-asterisk text-orange"></span>'
                               '</div>';
                    }
                }
            };

还有我的html:

<selectize options="model.items", config="model.facility_config", ng-model="modalObject.facility_id"></selectize>

样本数据可以是:

items = [{id: 1, facility_name: 'QA', state: 'LA', city: 'San Francisco', group_name: 'Teams'}];

0 个答案:

没有答案