running-coder / jquery-typeahead

Javascript Typeahead (autocomplete) plugin with more than 50 options and callbacks.
http://www.runningcoder.org/jquerytypeahead/
MIT License
544 stars 121 forks source link

Change name value to {{group}} #520

Closed bshunt29 closed 3 years ago

bshunt29 commented 4 years ago

I'm trying to figure out how I can search by group name. So instead of "q" it will say the group name(Address or City or County or Zip). I don't want to use the href because it is a post form.

` typeof $.typeahead === 'function' && $.typeahead({

        input: ".js-typeahead",
        minLength: 1,
        maxItem: 15,
        order: "asc",
        hint: true,
        dynamic: true,
        group: {
            template: "{{group}}"
        },

        maxItemPerGroup: 5,
        backdrop: {
            "background-color": "#fff"
        },
        //href: "/{{group}}/{{display}}/", 
        dropdownFilter: "Search All",
        emptyTemplate: 'No result for "{{query}}"',

        source: {
            Address: {
                data: data.Address,
                myKey: $("input[name=word]").val()

            },

            Cities: {
                data: data.Cities
            },
            "Zip Code": {
                data: data.Zip
            },
            County: {
                data: data.County
            }
        },
        callback: {
            onReady: function (node) {
                this.container.find('.' + this.options.selector.dropdownItem + '.group-Search a').trigger('click')
            },
            onDropdownFilter: function (node, query, filter, result) {
                console.log(query)
                console.log(filter)
                console.log(result)
            }

        },
        debug: true
    });`
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.