Я могу заставить работать обещание внутри объекта "addable:".после сохранения нового клиента идентификатор, добавленный в slimselect, должен дождаться нового _id.Спасибо
Оплатить *
var Datastore = require('nedb');
var dclipro = new Datastore({filename: '/data/clipro.db', autoload: true});
var selectclipro = new SlimSelect({
select: '#bcofid_clipro',
valuesUseText: false,
addable: function (value) {
var newid = "";
var agrabar = {
name: value,
last_idcuenta: "null",
email: "notdefined@gmail.com",
memo: "not available",
auditlog: moment().format('MMMM Do YYYY, h:mm:ss a')
}
dclipro.update({name: value}, agrabar, options, function (err, numReplaced, upsert) {
if (err) {
console.error(err);
}
newid = upsert._id;
})
iziToast.show({
title: 'Bank',
message: 'New Payee has been saved successfully',
position: 'topRight'
});
return { text: value, value: newid }
},
onChange: (info) => {
console.log('elegido : value ' +info.value);
console.log('elegido : text ' +info.text);
}
})