【问题标题】:Hardcode value to end of twitter bootstrap typeahead search dropdown将值硬编码到 twitter bootstrap typeahead search 下拉列表的末尾
【发布时间】:2013-05-31 11:30:17
【问题描述】:

我正在使用 twitter typeahead 处理搜索栏。除了一项功能外,我已经使其符合规范。我需要在链接到高级搜索页面的每个搜索的底部添加一个字段。我使用 knockout.js 填充数据数组。

 $('.search').typeahead({
            source: function (query, process) {
                map = {};
                $.each(data, function (i, data) {
                    map[data.text] = {
                        address: data.text2
                        , name: data.text
                    };
                    shops.push(data.text);
                });
                process(shops);
                shops = [];
            },
            minLength: 3,
            updater: function (item) {
                submit_search(item)
            },
            highlighter: function (item) {
                var p = map[item];
                var itm = ''
                         + "<div class='typeahead_wrapper'>"
                         + "<img class='typeahead_photo' src='content/images/pp-icon.png' />"
                         + "<div class='typeahead_labels'>"
                         + "<div class='typeahead_primary'>" + p.name + "</div>"
                         + "<div class='typeahead_secondary'>" + p.address + "</div>"
                         + "</div>"
                         + "</div>";
                return itm;
            },


        });

我没有成功地尝试匹配器函数在每次搜索结束时返回额外的项目。任何想法都会很棒。

【问题讨论】:

    标签: drop-down-menu bootstrap-typeahead


    【解决方案1】:

    jquery append 做到了。好旧的jquery

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-01
      相关资源
      最近更新 更多