|
@@ -39,8 +39,11 @@
|
|
minLength: 3,
|
|
minLength: 3,
|
|
source: function (request, response) {
|
|
source: function (request, response) {
|
|
$.ajax({
|
|
$.ajax({
|
|
- url: '{{ path(ajax_url) }}?q=' + request.term,
|
|
|
|
|
|
+ url: '{{ path(ajax_url) }}',
|
|
type: "GET",
|
|
type: "GET",
|
|
|
|
+ data: {
|
|
|
|
+ q: request.term
|
|
|
|
+ },
|
|
success: function (data) {
|
|
success: function (data) {
|
|
response($.map(data.results, function (el) {
|
|
response($.map(data.results, function (el) {
|
|
return {
|
|
return {
|
|
@@ -54,13 +57,19 @@
|
|
select: function (event, ui) {
|
|
select: function (event, ui) {
|
|
this.value = ui.item.label;
|
|
this.value = ui.item.label;
|
|
$('input[id="{{ id }}"]').val(ui.item.value);
|
|
$('input[id="{{ id }}"]').val(ui.item.value);
|
|
|
|
+ if (typeof(callbackClientId) === typeof (Function)) {
|
|
|
|
+ callbackClientId(ui.item.value);
|
|
|
|
+ }
|
|
event.preventDefault();
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
if ($('input[id="{{ id }}"]').val() > 0) {
|
|
if ($('input[id="{{ id }}"]').val() > 0) {
|
|
// carga el nombre cuando se esta modificando
|
|
// carga el nombre cuando se esta modificando
|
|
$.ajax({
|
|
$.ajax({
|
|
- url: '{{ ajax_url_data }}?q=' + $('input[id="{{ id }}"]').val(),
|
|
|
|
|
|
+ url: '{{ ajax_url_data }}',
|
|
|
|
+ data: {
|
|
|
|
+ q: $('input[id="{{ id }}"]').val()
|
|
|
|
+ },
|
|
success: function (result) {
|
|
success: function (result) {
|
|
if (result != null && result.results != null && result.results.length > 0) {
|
|
if (result != null && result.results != null && result.results.length > 0) {
|
|
$('input[id="{{ id }}_search"]').val(result.results[0].name);
|
|
$('input[id="{{ id }}_search"]').val(result.results[0].name);
|