typeahead will also show the column where the search terms comes from

This commit is contained in:
Uwe Steinmann 2023-04-21 16:52:07 +02:00
parent 89e930ba00
commit 3cfcfaa558
3 changed files with 3 additions and 3 deletions

View File

@ -362,7 +362,7 @@ $(document).ready(function() {
$recs[] = array('type'=>'S', 'name'=>$query, 'occurences'=>'');
if($terms) {
foreach($terms as $term)
$recs[] = array('type'=>'S', 'name'=>$term->text, 'occurences'=>$term->_occurrence);
$recs[] = array('type'=>'S', 'name'=>$term->text, 'occurences'=>$term->_occurrence, 'column'=>$term->field);
}
if($entries) {
foreach ($entries as $entry) {

View File

@ -150,7 +150,7 @@ function initMost() {
else if(item.type.charAt(0) == 'F')
return '<i class="fa fa-folder-o"></i> ' + item.name.replace(/</g, '&lt;') + '<br /><span class="path">' + item.path + '</span>';
else
return '<i class="fa fa-search"></i> ' + item.name.replace(/</g, '&lt;') + (item.occurences > 0 ? ' (' + item.occurences + ')' : '');
return '<i class="fa fa-search"></i> ' + item.name.replace(/</g, '&lt;') + (item.occurences > 0 ? ' (' + item.occurences + ')' : '') + (typeof(item.column) != 'undefined' ? '<br /><span class="path">' + item.column + '</span>' : '');
},
/* This only works with a modified version of bootstrap typeahead located
* in boostrap-typeahead.js Search for 'render'

View File

@ -155,7 +155,7 @@ function initMost() {
else if(item.type.charAt(0) == 'F')
return '<i class="fa fa-folder-o"></i> ' + item.name.replace(/</g, '&lt;') + '<br /><span class="path">' + item.path + '</span>';
else
return '<i class="fa fa-search"></i> ' + item.name.replace(/</g, '&lt;') + (item.occurences > 0 ? ' (' + item.occurences + ')' : '');
return '<i class="fa fa-search"></i> ' + item.name.replace(/</g, '&lt;') + (item.occurences > 0 ? ' (' + item.occurences + ')' : '') + (typeof(item.column) != 'undefined' ? '<br /><span class="path">' + item.column + '</span>' : '');
},
/* This only works with a modified version of bootstrap typeahead located
* in boostrap-typeahead.js Search for 'render'