从父容器public static boolean savePropertiesToURL(Properties properties, String link, String fileName) {
boolean result = false;
if (properties != null && link != null && fileName != null) {
try {
URL url = new URL(link);
try {
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
try {
OutputStream outStream = connection.getOutputStream();
try {
properties.store(outStream, fileName);
} catch (IOException ex) {
System.err.println("Unable to store the properties: " + ex.getMessage());
} finally {
try {
outStream.flush();
result = true;
} catch (IOException ex) {
Logger.getLogger(PropertiesUtil.class.getName()).log(Level.SEVERE, null, ex);
System.err.println("Unable to flush outputstream: " + ex.getMessage());
}
outStream.close();
}
} catch (IOException ex) {
System.err.println("Unable to get outputstream: " + ex.getMessage());
}
} catch (IOException ex) {
System.err.println("Unable to open URL connexion: " + ex.getMessage());
}
} catch (MalformedURLException ex) {
System.err.println("The URL hasn't been created: " + ex.getMessage());
}
}
return result;
}
拖动元素之后,我希望从克隆容器id=left-copy-1tomany
中删除一些克隆的元素。我想使用id=right-copy-1tomany
函数将其删除,该函数应让我将元素拖出容器以将其删除。有没有办法使克隆代码起作用?
HTML :
removeOnSpill: true
JS :
<div class='parent'>
<div class='wrapper'>
<div id='right-copy-1tomany' class='container'></div>
<div id='left-copy-1tomany' class='container'>
<div>TEST BOX 1</div>
<div>TEST BOX 2</div>
<div>TEST BOX 3</div>
<div>TEST BOX 4</div>
<div>TEST BOX 5</div>
</div>
</div>
</div>
</div>
<h4>Dragule Code:</h4>
答案 0 :(得分:0)
在 dropModel()事件中尝试使用el.remove()
:
this.dragulaService.dropModel("<dragula-id>")
.subscribe(({ name, el, target, source, sibling, sourceModel, targetModel, item }) => {
if (<condition-to-remove>) {
el.remove()
}
});