我试图在图表中设置连接器数据源,但未设置连接器。
检查该图时,成员源已填充,但连接器源为空。
我的代码是这样的:
Html.Kendo().Diagram()
//Set Members DataSource
.DataSource(ds => ds
.Read(read => read.Action("MembersActionName", "ControllerName")
.Model(m =>
{
m.Id("MemberId");
})
)
//Set Connectors DataSource
.ConnectionsDataSource(cds => cds
.Read(read => read.Action("ConnectorsActionName", "ControllerName")
.Model(m =>
{
m.From("SourceMemberId");
m.To("DestinationMemberId");
m.Id("ConnectionId");
})
)
.AutoBind(true)
.Layout(l => l
.Type(DiagramLayoutType.Tree)
.Subtype(DiagramLayoutSubtype.Down)
)
.ShapeDefaults(sd => sd.Visual("visualTemplate"))
.ConnectionDefaults(cd =>
{
cd.Stroke(s => s.Color("#006bab").Width(1));
cd.Type(DiagramConnectionType.Polyline);
cd.StartCap(st =>
{
st.Type("FilledCircle");
st.Fill(stf => stf.Color("#006bab"));
});
cd.EndCap(st =>
{
st.Type("ArrowEnd");
st.Fill(stf => stf.Color("#006bab"));
});
})
.Render();