Getconnection() 不适用于状态机
Getconnection() not working for state machine
我正在使用 jsPlumb statemachine. I would like to save and load my chart later. I googled and found that I would have to do it using json Object. I tried few examples Whosebug。我能够获得每个盒子的位置,但我无法获得连接。我看到的所有示例都使用 jsPlumb.getConnections()
但对我来说它不起作用。我已经动态添加了这些连接和框。
如果您要修改示例代码,您需要将 'instance' 变量设置为全局变量,然后对其调用 getConnections() 方法。
instance = jsPlumb.getInstance({
Endpoint: ["Dot", {radius: 1}],
HoverPaintStyle: {strokeStyle: "#1e8151", lineWidth: 1},
ConnectionOverlays: [
["Arrow", {
location: 1,
id: "arrow",
length: 10,
width: 15,
foldback: 1
}],
["Label", {label: "FOO", id: "label", cssClass: "aLabel"}]
],
Container: "statemachine"
});
//...
instance.getConnections()
我正在使用 jsPlumb statemachine. I would like to save and load my chart later. I googled and found that I would have to do it using json Object. I tried few examples Whosebug。我能够获得每个盒子的位置,但我无法获得连接。我看到的所有示例都使用 jsPlumb.getConnections()
但对我来说它不起作用。我已经动态添加了这些连接和框。
如果您要修改示例代码,您需要将 'instance' 变量设置为全局变量,然后对其调用 getConnections() 方法。
instance = jsPlumb.getInstance({
Endpoint: ["Dot", {radius: 1}],
HoverPaintStyle: {strokeStyle: "#1e8151", lineWidth: 1},
ConnectionOverlays: [
["Arrow", {
location: 1,
id: "arrow",
length: 10,
width: 15,
foldback: 1
}],
["Label", {label: "FOO", id: "label", cssClass: "aLabel"}]
],
Container: "statemachine"
});
//...
instance.getConnections()