Как искать по идентификатору и имени - PullRequest
0 голосов
/ 19 сентября 2019
$input.typeahead({
                    minLength : 3,
                    source: function(query, process) {
                return $.get("{% url 'dashboard:get-patient-list' %}", { query: query }, function (data) {
                            console.log(data);
                        return process(data);
                });
                },
                  autoSelect: false
                });

                $input.change(function() {
                    // console.log($input);
                  var current = $input.typeahead("getActive");
                    // console.log(current);
                    // console.log(current.id);
                  if (current) {
                    // Some item from your model is active!
                    if (current.name == $input.val()) {
                      // This means the exact match is found. Use toLowerCase() if you want case insensitive match.
                    } else {
                      // This means it is only a partial match, you can either add a new item
                      // or take the active if you don't want new items
                    }
                  } else {
                    // Nothing is active so it is a new value (or maybe empty value)
                  }
                });

Я использую начальную загрузку Twitter вместе с django.Я хочу сделать его доступным для поиска как по имени, так и по имени.Как это можно сделать?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...