Плохо попробуйте пользователь jsPlumb: Блок-схема в динамическом контенте MySQL.Использование jsPlumb с динамическим контентом
Мой код основан на демонстрационном примере для Flowchart: JQuery
им генерировать мои Endpoints в моей базе данных запроса
$plumb .= '_addEndpoints("drag'.$id_kurs.'", ["TopCenter", "BottomCenter", "LeftMiddle", "RightMiddle"]);
и им добавить его в мое содержание в конце содержимого базы данных
$vorschau .= ' </div>
</DIV>
<script>
jsPlumb.ready(function() {
var instance = jsPlumb.getInstance({
DragOptions : { cursor: "pointer", zIndex:2000 },
ConnectionOverlays : [
[ "Arrow", { location:1 } ],
[ "Label", {
location:0.5,
id:"label",
cssClass:"aLabel"
}]
],
});
var connectorPaintStyle = {
lineWidth:2,
strokeStyle:"#db0018",
joinstyle:"round",
outlineColor:"white",
outlineWidth:1
},
// .. and this is the hover style.
connectorHoverStyle = {
lineWidth:2,
strokeStyle:"#000000",
outlineWidth:1,
outlineColor:"white"
},
endpointHoverStyle = {
fillStyle:"#000000",
strokeStyle:"#db0019"
},
sourceEndpoint = {
endpoint:["Rectangle",{ width:18, height:18}],
paintStyle:{
fillStyle:"#db0013"
},
maxConnections:999,
isSource:true,
isTarget:true,
connector:[ "Flowchart", { stub:[40, 60], gap:10, cornerRadius:5, alwaysRespectStubs:true } ],
connectorStyle:connectorPaintStyle,
hoverPaintStyle:endpointHoverStyle,
connectorHoverStyle:connectorHoverStyle,
dragOptions:{}
},
init = function(connection) {
connection.getOverlay("label").setLabel(connection.sourceId.substring(15) + "-" + connection.targetId.substring(15));
connection.bind("editCompleted", function(o) {
if (typeof console != "undefined")
console.log("connection edited. path is now ", o.path);
});
};
var _addEndpoints = function(toId, sourceAnchors, targetAnchors) {
for (var i = 0; i < sourceAnchors.length; i++) {
var sourceUUID = toId + sourceAnchors[i];
instance.addEndpoint("flowchart" + toId, sourceEndpoint, { anchor:sourceAnchors[i], uuid:sourceUUID });
}
};
instance.doWhileSuspended(function() {
'.$plumb.'
instance.bind("connection", function(connInfo, originalEvent) {
init(connInfo.connection);
});
instance.bind("click", function(conn, originalEvent) {
if (confirm("Delete connection from " + conn.sourceId + " to " + conn.targetId + "?"))
jsPlumb.detach(conn);
});
instance.bind("connectionDrag", function(connection) {
console.log("connection " + connection.id + " is being dragged. suspendedElement is ", connection.suspendedElement, " of type ", connection.suspendedElementType);
});
instance.bind("connectionDragStop", function(connection) {
console.log("connection " + connection.id + " was dragged");
});
instance.bind("connectionMoved", function(params) {
console.log("connection " + params.connection.id + " was moved");
});
});
});
</script>';
все, что находится в пределах функции
структура HTML/CSS показывает правильно, но он выиграл t показать мои конечные точки.
Я включил все необходимые файлы js/css, как я сказал им, используя DEMO в качестве подвала для моего кода.
Мое сообщение об ошибке:
TypeError: el is null
...fsetTop, op = (relativeToRoot || (container != null && el.offsetParent != conta...
Линия в РОМ адаптера ошибка в отношении:
var l = el.offsetLeft, t = el.offsetTop, op = (relativeToRoot || (container != null && el.offsetParent != container)) ? el.offsetParent : null;
1. Невозможно найти строки, создающие источники/цели/конечные точки. 2. Создайте скрипку, демонстрирующую проблему. –
Эй, цель/конечная точка такая же, как вы видите, я устанавливаю sourceEndpoint в isSource: true и isTarget: true и im, добавляя их в течение некоторого времени (данные SQL) в $ plumb, и, как вы можете видеть, он включен в тег там – xQp
'sourceEndpoint' - это переменная, которая не передается ни одному вызову/функции. –