mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Ajoute des suggestions quand rien n'est écrit
This commit is contained in:
parent
a156010262
commit
e5bdff792b
1 changed files with 14 additions and 3 deletions
|
@ -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 ):
|
||||
|
|
Loading…
Reference in a new issue