mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-27 10:22:17 +00:00
Minor fix to static file serving
This commit is contained in:
23
RIGS/static/js/autocompleter.js
Normal file
23
RIGS/static/js/autocompleter.js
Normal file
@@ -0,0 +1,23 @@
|
||||
$(document).ready(function() {
|
||||
$(".autocomplete-json").each(function() {
|
||||
var field = $(this)
|
||||
$.getJSON($(this).data('valueurl'), function(json) {
|
||||
field.val(json[0]['fields']['name']);
|
||||
});
|
||||
var source = $(this).data('sourceurl');
|
||||
$(this).autocomplete({
|
||||
source: source,
|
||||
minLength: 3,
|
||||
focus: function(e, ui) {
|
||||
e.preventDefault();
|
||||
$(this).val(ui.item.label);
|
||||
|
||||
},
|
||||
select: function(e, ui) {
|
||||
e.preventDefault();
|
||||
$(this).val(ui.item.label);
|
||||
$("#"+$(this).data('target')).val(ui.item.value)
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user