combo_auto_box 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
@@ -46,17 +46,17 @@ var ComboAutoBox = {
|
|
46
46
|
if (e.which === 13) {
|
47
47
|
if (options.type == 'full') {
|
48
48
|
$('#' + inputId).autocomplete( "close" );
|
49
|
-
selectData($('#' + inputId).val());
|
49
|
+
selectData($('#' + inputId).val(), $('#' + inputId).val());
|
50
50
|
} else if (options.type == 'multiple') {
|
51
51
|
$('#' + inputId).autocomplete( "close" );
|
52
52
|
addItem(inputId, $('#' + inputId).val(), $('#' + inputId).val());
|
53
|
-
selectData($('#' + inputId).val());
|
53
|
+
selectData($('#' + inputId).val(), $('#' + inputId).val());
|
54
54
|
$('#' + inputId).val('');
|
55
55
|
} else if ((options.type == 'searchable') && ($('#' + inputId).val()) != '') {
|
56
56
|
try {
|
57
57
|
var item = sourceForSearchable(inputId)[0];
|
58
58
|
addSearchableItemForRansack(inputId, item.id, item.label);
|
59
|
-
selectData(item.id);
|
59
|
+
selectData(item.id, item.label);
|
60
60
|
$('#' + inputId).val('');
|
61
61
|
$('#' + inputId).autocomplete('close');
|
62
62
|
} catch (error) {
|
@@ -71,18 +71,18 @@ var ComboAutoBox = {
|
|
71
71
|
source: setAutoCompleteSource(inputId),
|
72
72
|
select: function(event, ui) {
|
73
73
|
if (options.type == 'simple') {
|
74
|
-
return selectData(ui.item.id);
|
74
|
+
return selectData(ui.item.id, ui.item.label);
|
75
75
|
} else if (options.type == 'full') {
|
76
|
-
return selectData($('#' + inputId).val());
|
76
|
+
return selectData($('#' + inputId).val(), $('#' + inputId).val());
|
77
77
|
} else if (options.type == 'multiple') {
|
78
78
|
$('#' + inputId).val('');
|
79
79
|
addItem(inputId, ui.item.id, ui.item.label);
|
80
|
-
selectData(ui.item.id);
|
80
|
+
selectData(ui.item.id, ui.item.label);
|
81
81
|
return false;
|
82
82
|
} else if (options.type == 'searchable') {
|
83
83
|
$('#' + inputId).val('');
|
84
84
|
addSearchableItemForRansack(inputId, ui.item.id, ui.item.label);
|
85
|
-
selectData(ui.item.id);
|
85
|
+
selectData(ui.item.id, ui.item.label);
|
86
86
|
return false;
|
87
87
|
}
|
88
88
|
},
|
@@ -277,12 +277,12 @@ var ComboAutoBox = {
|
|
277
277
|
|
278
278
|
if (options.type == 'simple') {
|
279
279
|
$('#' + container + ' > div.container-combo-auto-box > input').val(thisLabel);
|
280
|
-
selectData(thisId);
|
280
|
+
selectData(thisId, thisLabel);
|
281
281
|
} else if (options.type == 'multiple') {
|
282
282
|
$('#' + container + ' > div.container-combo-auto-box > input').val('');
|
283
283
|
addItem($('#' + container + ' > div.container-combo-auto-box > input').attr('id'), thisLabel, thisLabel);
|
284
284
|
$('#' + container + ' > div.container-combo-auto-box > input[type="text"]').focus();
|
285
|
-
selectData(thisId);
|
285
|
+
selectData(thisId, thisLabel);
|
286
286
|
}
|
287
287
|
});
|
288
288
|
};
|
@@ -416,19 +416,19 @@ var ComboAutoBox = {
|
|
416
416
|
}
|
417
417
|
|
418
418
|
// on select data
|
419
|
-
var selectData = function (
|
419
|
+
var selectData = function (selectedId, selectedLabel) {
|
420
420
|
if (options.complete != null) {
|
421
|
-
options.complete(
|
421
|
+
options.complete(selectedId);
|
422
422
|
} else if (options.select != null) {
|
423
|
-
options.select(
|
423
|
+
options.select(selectedId, selectedLabel);
|
424
424
|
}
|
425
425
|
|
426
426
|
};
|
427
427
|
|
428
428
|
// on unselect data
|
429
|
-
var unselectData = function (selectedId,
|
429
|
+
var unselectData = function (selectedId, selectedLabel) {
|
430
430
|
if (options.unselect != null) {
|
431
|
-
options.unselect(selectedId,
|
431
|
+
options.unselect(selectedId, selectedLabel);
|
432
432
|
}
|
433
433
|
};
|
434
434
|
|