Hi there,
I have two questions concerning the MVC Diagram. First, why is there a different loading approach for shapes and connections? It seems as sometimes, my datasource is too slow to read both quick enough, so I have only shapes, but no connections... Is there any possibility to show errors / loading progress?
See my code listed below. The datasource controller methods are normal Json(List<T>.ToDataSourceResult()) calls...
@(Html.Kendo().Diagram<DiagramEditNodeVm, DiagramEditEdgeVm>()
.Name("DAA")
.HtmlAttributes(new { style = "height: 700px; width:1400px" })
.Layout(l => l
.Type(DiagramLayoutType.Tree)
.Subtype(DiagramLayoutSubtype.Down)
.HorizontalSeparation(50)
.VerticalSeparation(50)
)
.ShapeDefaults(sd => sd
.Visual("visualTemplate")
.Content(c => c
.FontSize(12)
)
)
.ConnectionDefaults(cd => cd
.Stroke(s => s
.Color("#586477")
.Width(2)
)
)
.Events(events => events
.Edit("onEdit")
)
.DataSource(d => d
.ShapeDataSource()
.Model(m =>
{
m.Id(n => n.Id);
m.Field(n => n.Id).Editable(false);
m.Field(n => n.Title);
m.Field(n => n.StatusBit).Editable(false);
//m.Field(s => s.ChildList).Editable(false);
//m.Field(s => s.ParentList).Editable(false);
//m.Field(s => s.MdeConnectionList).Editable(false);
//m.Field(s => s.AttributeList).Editable(false);
})
.Read("ReadNodes", "Diagram", new
{
id= ViewContext.RouteData.Values["id"] != null ?
Int32.Parse(ViewContext.RouteData.Values["id"].ToString())
: 0
})
.Create("CreateNode", "Diagram")
.Destroy("DeleteNode", "Diagram")
.Update("UpdateNode", "Diagram")
)
.ConnectionsDataSource(d => d
.Model(m =>
{
m.Id(e => e.Id);
m.Field(e => e.Id).Editable(false);
m.From(e => e.ParentNodeId);
m.To(e => e.ChildNodeId);
//m.FromX(c => c.FromPointX);
//m.FromY(c => c.FromPointY);
//m.ToX(c => c.ToPointX);
//m.ToY(c => c.ToPointY);
})
.Read("ReadEdges", "Diagram", new
{
id = ViewContext.RouteData.Values["id"] != null ?
Int32.Parse(ViewContext.RouteData.Values["id"].ToString())
: 0
})
.Create("CreateEdge", "Diagram")
.Destroy("DeleteEdge", "Diagram")
.Update("UpdateEdge", "Diagram")
)
)