Hi,
Quote:I would like to save values in the HTML5 data attribute of a node using C#. I'm using a ShapeNode. Values can be i.e. the database ID of the node. How can I do that?
There aren't any HTML DOM elements associated with nodes on the client side, so no HTML5 data attributes either. The diagram items are JavaScript objects that can draw themselves on a Canvas element. You can associate custom data with nodes by setting their Tag or Id property on server, and access it via getTag() and getId() on client side.
Quote:I'm starting to wonder if it isn't better to 'draw' the diagram in the ready() event so that it is drawn by the browser as opposed to the server using client code. That would easily solve my question above. But then I might as well use the Javascript components and not the MVC (I think). Or should I use MVC and only use client code? I can pass in my viewmodel and have Javascript code handle everything. You don't have any examples of that, but I think I can work it out.
There's nothing wrong with building the diagram on the client side, most of the API is available in JavaScript too. You could also save some bandwidth that way by sending only your bare-bones model data instead of the diagram JSON arrays containing all attributes of nodes and links. You can find some examples and tutorials that build diagrams in JavaScript coming with our standalone JavaScript library:
http://mindfusion.eu/onlinedemo-jsdiagram.htmlhttp://www.mindfusion.eu/onlinehelp/jsdiagram/index.htm?CC_Tutorial_1__Loading_G... Quote:Have you done any performance tests between having the server draw the diagram and the client do it? How does it compare?
JavaScript is still much slower than the .NET runtime and some operations will run faster on the server, e.g. automatic graph layout algorithms. If you expect many users running graph layouts at the same time, you might still want to offload them to client side though, or your server could crash
![Wink Wink](https://mindfusion.eu/yabbfiles/Templates/Forum/default/wink.gif)
I hope that helps,
Stoyan