forked from ktalbi/TaxHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix : bug lorsqu'un attribut n'a pas de valeur à valeur_attribut * Style autocomplete + erreur js
- Loading branch information
1 parent
2f518fb
commit f4dd5cb
Showing
3 changed files
with
33 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,34 @@ | ||
$(document).ready(function () { | ||
let search = document.getElementById("search_value").value; | ||
$(".taxref-autocomplete").select2({ | ||
ajax: { | ||
url: function (params) { | ||
if (search !== undefined && params == "") { | ||
params = search; | ||
} | ||
return URL_API_AUTOCOMPLETE + "?search_name=" + params; | ||
|
||
|
||
$('.jquery-select2').select2(); | ||
|
||
if (document.getElementById("search_value")) { | ||
let search = document.getElementById("search_value").value; | ||
$(".taxref-autocomplete").select2({ | ||
ajax: { | ||
url: function (params) { | ||
if (search !== undefined && params == "") { | ||
params = search; | ||
} | ||
return URL_API_AUTOCOMPLETE + "?search_name=" + params; | ||
}, | ||
results: function (data, page) { | ||
var data = $.map(data, function (obj) { | ||
var search_name = obj.search_name.replace("<i>", ""); | ||
search_name = search_name.replace("</i>", ""); | ||
obj.id = obj.cd_nom; | ||
obj.text = search_name; | ||
return obj; | ||
}); | ||
return { results: data }; | ||
}, | ||
}, | ||
results: function (data, page) { | ||
var data = $.map(data, function (obj) { | ||
var search_name = obj.search_name.replace("<i>", ""); | ||
search_name = search_name.replace("</i>", ""); | ||
obj.id = obj.cd_nom; | ||
obj.text = search_name; | ||
return obj; | ||
}); | ||
return { results: data }; | ||
}, | ||
}, | ||
dataType: "json", | ||
delay: 250, | ||
placeholder: "Nom latin, nom vernaculaire, cd_nom", | ||
minimumInputLength: 3, | ||
}); | ||
dataType: "json", | ||
delay: 250, | ||
placeholder: "Nom latin, nom vernaculaire, cd_nom", | ||
minimumInputLength: 3, | ||
}); | ||
|
||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters