mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-31 05:57:34 +00:00
- added typeahead function for document and folder chooser
This commit is contained in:
parent
d20c0beff3
commit
c3b289ce3f
|
@ -58,4 +58,62 @@ $(document).ready( function() {
|
||||||
return '<i class="icon-search"></i> ' + item.substring(1);
|
return '<i class="icon-search"></i> ' + item.substring(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* Document chooser */
|
||||||
|
$("#choosedocsearch").typeahead({
|
||||||
|
minLength: 3,
|
||||||
|
formname: 'form1',
|
||||||
|
source: function(query, process) {
|
||||||
|
// console.log(this.options);
|
||||||
|
$.get('../op/op.Ajax.php', { command: 'searchdocument', query: query, limit: 8 }, function(data) {
|
||||||
|
process(data);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/* updater is called when the item in the list is clicked. It is
|
||||||
|
* actually provided to update the input field, but here we use
|
||||||
|
* it to set the document location. */
|
||||||
|
updater: function (item) {
|
||||||
|
strarr = item.split("#");
|
||||||
|
//console.log(this.options.formname);
|
||||||
|
$('#docid' + this.options.formname).attr('value', strarr[0]);
|
||||||
|
return strarr[1];
|
||||||
|
},
|
||||||
|
/* Set a matcher that allows any returned value */
|
||||||
|
matcher : function (item) {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
highlighter : function (item) {
|
||||||
|
strarr = item.split("#");
|
||||||
|
return '<i class="icon-file"></i> ' + strarr[1];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Folder chooser */
|
||||||
|
$("#choosefoldersearch").typeahead({
|
||||||
|
minLength: 3,
|
||||||
|
formname: 'form1',
|
||||||
|
source: function(query, process) {
|
||||||
|
// console.log(this.options);
|
||||||
|
$.get('../op/op.Ajax.php', { command: 'searchfolder', query: query, limit: 8 }, function(data) {
|
||||||
|
process(data);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/* updater is called when the item in the list is clicked. It is
|
||||||
|
* actually provided to update the input field, but here we use
|
||||||
|
* it to set the document location. */
|
||||||
|
updater: function (item) {
|
||||||
|
strarr = item.split("#");
|
||||||
|
//console.log(this.options.formname);
|
||||||
|
$('#targetid' + this.options.formname).attr('value', strarr[0]);
|
||||||
|
return strarr[1];
|
||||||
|
},
|
||||||
|
/* Set a matcher that allows any returned value */
|
||||||
|
matcher : function (item) {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
highlighter : function (item) {
|
||||||
|
strarr = item.split("#");
|
||||||
|
return '<i class="icon-folder-close"></i> ' + strarr[1];
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user