Commit e5bdff79 authored by Maël Kervella's avatar Maël Kervella

Ajoute des suggestions quand rien n'est écrit

parent a1560102
......@@ -142,7 +142,7 @@ def typeahead_choices( f_value ) :
'];'
def typeahead_engine () :
return 'var choices = new Bloodhound({ ' \
return 'var engine = new Bloodhound({ ' \
'datumTokenizer: Bloodhound.tokenizers.obj.whitespace("value"), ' \
'queryTokenizer: Bloodhound.tokenizers.whitespace, ' \
'local: choices, ' \
......@@ -153,7 +153,7 @@ def typeahead_datasets( f_name ) :
return '{ ' \
'hint: true, ' \
'highlight: true, ' \
'minLength: 1 ' \
'minLength: 0 ' \
'}, ' \
'{ ' \
'templates: { ' \
......@@ -161,7 +161,18 @@ def typeahead_datasets( f_name ) :
'}, ' \
'display: "value", ' \
'name: "'+f_name+'", ' \
'source: choices ' \
'source: function(q, sync) {' \
'if (q === "") {' \
'var nb = 10;' \
'var first = [] ;' \
'for ( var i = 0 ; i < nb ; i++ ) {' \
'first.push(choices[i].value);' \
'}' \
'sync(engine.get(first));' \
'} else {' \
'engine.search(q, sync)' \
'}' \
'}' \
'}'
def typeahead_updater( f_name ):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment