$(document).ready(function(){
    //autocomplete for trait search
    $("#search_trait").autocomplete({
        position: {
            my: "right top", at: "right bottom"
        },
        source: function (request, response) {
            var search = request.term;
            $.ajax({
                url: "{{ path('api', {'namespace': 'listing', 'classname': type~'s'}) }}",
                data: {term:  request.term, limit: 500, search: search, dbversion: '{{ dbversion }}'},
                dataType: "json",
                success: function (data) {
                    response(data);
                }
            });
        },
        minLength: 3
    });

    $("#search_trait").data("ui-autocomplete")._renderItem = function (ul, item) {
        var details = Routing.generate('{{ type }}_details', {'dbversion': '{{ dbversion }}', 'trait_type_id': item.trait_type_id});
        var link = "<a href='"+details+"'><span style='display:inline-block; width: 100%; font-style: italic;'>" + item.name + "</span></a>";
        var li = $("<li>")
                .append(link)
                .appendTo(ul);
        return li;
    };

    $("#btn_search_trait").click(function(){
        var searchTerm = $("#search_trait").val();
        var resultPage = Routing.generate('{{ type }}_result', {'dbversion': '{{ dbversion }}', 'limit': 500, 'search': searchTerm});
        window.location.href = resultPage;
    });
});
Add quick search jsx template for trait page
Add quick search jsx template for trait page
