Files
iTop/js/links/linkset.js
bdalsass de35d941c1 N°6154 N°6219 - Relations Read - tooltip, confirmation title and message (#486)
N°6154 - n:n Read - tooltip, confirmation title and message on Add-Edit-Remove
N°6219 - 1:n Read: tooltip, modal title and message on Add-Edit-Remove-Delete
2023-04-28 14:43:53 +02:00

42 lines
1.1 KiB
JavaScript

const iTopLinkSet = new function () {
/**
* Create a new link object and add it to set widget.
*
* @param sLinkedClass
* @param sCode
* @param sHostObjectClass
* @param sHostObjectKey
* @param sRemoteExtKey
* @param sRemoteClass
* @param oWidget
* @constructor
*/
const CallCreateLinkedObject = function(sLinkedClass, oWidget)
{
// Create link object
iTopObjectWorker.CreateObject(Dict.S('UI:Links:Object:New:Modal:Title'), sLinkedClass, function(){
$(this).find("form").remove();
$(this).dialog('destroy');
},
function(event, data){
// We have just create a link object, now request the remote object
iTopObjectWorker.GetObject(data.data.object.class_name, data.data.object.key, function(data){
// Add the new remote object in widget set options list
const selectize = oWidget[0].selectize;
selectize.addOption(data.data.object);
selectize.refreshOptions(false);
// Select the new remote object
selectize.addItem(data.data.object.key);
});
});
}
return {
CreateLinkedObject: CallCreateLinkedObject,
}
};