1

我想知道是否可以在令牌输入搜索的结果列表中定义部分标题(一种禁用的标题项,将标题跟随结果)?

我试过这样做,但这只是一种解决方法,它的行为不像我期望的那样:

onResult         : function (results) {
            var currentCategory = '';
            $.each(results, function (index, value) {
                if (value.category != currentCategory) {
                    results.splice(index, 0, {name : value.category});
                    currentCategory = value.category;
                }
            });
            return results;
        },
resultsFormatter: function(item){
            if (!item.hasOwnProperty('id')) {
                return "<li class='header-list-token-input'>" + item.name + "</li>";
            } else {
                return "<li>" + item.name + "</li>";
            }
        }

插件中是否有任何选项允许此功能?

任何帮助将非常感激 !

4

0 回答 0