Modernise the typeahead stuff to squash some bugs.

This commit is contained in:
James Cole
2018-09-17 17:41:34 +02:00
parent f76fdedd25
commit 744d45fb04
19 changed files with 228 additions and 148 deletions

View File

@@ -137,39 +137,10 @@ function parseRepetitionSuggestions(data) {
}
function initializeAutoComplete() {
// auto complete things:
$.getJSON('json/tags').done(function (data) {
var opt = {
typeahead: {
source: data,
afterSelect: function () {
this.$element.val("");
},
autoSelect: false,
},
autoSelect: false,
};
$('input[name="tags"]').tagsinput(
opt
);
});
if ($('input[name="destination_name"]').length > 0) {
$.getJSON('json/expense-accounts').done(function (data) {
$('input[name="destination_name"]').typeahead({source: data, autoSelect: false});
});
}
if ($('input[name="source_name"]').length > 0) {
$.getJSON('json/revenue-accounts').done(function (data) {
$('input[name="source_name"]').typeahead({source: data, autoSelect: false});
});
}
$.getJSON('json/categories').done(function (data) {
$('input[name="category"]').typeahead({source: data, autoSelect: false});
});
initTagsAC();
initExpenseAC();
initRevenueAC();
initCategoryAC();
}
/**