Hi,
Here is the scenario:
There is a list of managers and their infos(Bank Name, IBAN Number...) on the page. If the user(admin) wants to add a manager to the list, he or she can type the name and find the manager to add. Here is the code for this:
Manager.nameInput.select2({
minimumInputLength: 2,
ajax: {
url: 'assets/data/managers.json',
dataType: 'json',
data: function (term) {
return {
q: term
};
},
results: function (data) {
return {results: data.managers};
}
},
formatResult: nameFormatResult,
formatSelection: nameFormatSelection
});
and if the user wants to update the managers informations, he or she can click the update button in the list item. To provide this I wrote this code:
Manager.nameInput.select2('val', {id: Manager.$id, text:Manager.$name.text()});
(and I have to disable selection after updating value)
But it doesn't set this value. I think it's because select2 initilized with ajax at the beginning.
Is there any solution for this?
Thanks,
Sevil