use data ttribute for autocompletion

this moves the whole field creation to a separate function and adds the
full qualified column name as a data attribute. This is needed because
we can not rely on the field's name to figure out the column name as it
will be unrelated in bureaucracy use
This commit is contained in:
Andreas Gohr
2016-03-30 10:37:51 +02:00
parent fbc72efb40
commit ed3de3d67c
3 changed files with 43 additions and 22 deletions

View File

@ -86,10 +86,7 @@ jQuery(function () {
jQuery('input.struct_autocomplete').autocomplete({
ismulti: false,
source: function (request, cb) {
var name = this.element.attr('name');
name = name.substring(19, name.length - 1);
name = name.replace('][', '.');
var name = jQuery(this.element[0]).closest('label').data('column');
var term = request.term;
if (this.options.ismulti) {
term = extractLast(term);