Filtering av users

This commit is contained in:
nikolark committed 2012-11-10 23:40:16 +01:00
1 parent 368228e5fa
commit 3e11ea9b75
2 files changed
+5 -4

No files matched your search

+4 -3
View File
@@ -21,7 +21,8 @@ $(document).ready(function() {
}); });
} }
function filter_customers(typed) { function filter_customers(typed) {
/* FIXME: Does not work well. */ /* FIXME: Does not work. */
console.log(typed);
setTimeout(function() { setTimeout(function() {
$("li.customer").each(function(i) { $("li.customer").each(function(i) {
if($(this).children("span.name").text().indexOf(typed) == -1) { if($(this).children("span.name").text().indexOf(typed) == -1) {
@@ -38,8 +39,8 @@ $(document).ready(function() {
}, 50); }, 50);
} }
/* Customer search */ /* Customer search */
$('.typeahead').typeahead(); //$('.typeahead').typeahead();
$('#id_customer_name').keydown(function(event) { $('#id_customer_typeahead').keyup(function(event) {
filter_customers(event.srcElement.value); filter_customers(event.srcElement.value);
}); });
/* Customer selection */ /* Customer selection */
+1 -1
View File
@@ -87,7 +87,7 @@
</section> </section>
{% endblock %} {% endblock %}
{% block tailinc %} {% block tailinc %}
<script src="{{ STATIC_URL }}js/bootstrap-typeahead.js"></script> <!--<script src="{{ STATIC_URL }}js/bootstrap-typeahead.js"></script>-->
<script src="{{ STATIC_URL }}js/bootstrap-tooltip.js"></script> <script src="{{ STATIC_URL }}js/bootstrap-tooltip.js"></script>
<script src="{{ STATIC_URL }}js/register.js"></script> <script src="{{ STATIC_URL }}js/register.js"></script>
{% endblock %} {% endblock %}