Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Loaded from xml diagram opens in some view mode (Read 7725 times)
Vitaliy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 7
Joined: Feb 13th, 2017
Loaded from xml diagram opens in some view mode
Feb 24th, 2017 at 9:56am
Print Post  
When diagram is loaded from xml there is no grid, and shapes selection is not the same when create diagram. There is some "view" mode. I cannot draw links between shapes. How I can enable "edit" mode?
  

WorkflowReadOnly.JPG ( 13 KB | 164 Downloads )
WorkflowReadOnly.JPG
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Loaded from xml diagram opens in some view mode
Reply #1 - Feb 24th, 2017 at 12:21pm
Print Post  
You are calling client-side Diagram.loadFromXml method? It wasn't loading Grid* and Behavior properties, so they remained with initial values. Attached new version of the script should load them now.
  

MindFusion_Diagramming.zip ( 126 KB | 173 Downloads )
Back to top
 
IP Logged
 
Vitaliy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 7
Joined: Feb 13th, 2017
Re: Loaded from xml diagram opens in some view mode
Reply #2 - Feb 24th, 2017 at 2:08pm
Print Post  
I use server-side initialization of Diagram. Use _diagramView object of DiagramView class. Call  _diagramView.LoadFromString(workflowTemplate) method to load from string that is in xml format. after that I tried to set  _diagramView.Behavior = Behavior.Modify, but result is the same.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Loaded from xml diagram opens in some view mode
Reply #3 - Feb 24th, 2017 at 2:36pm
Print Post  
Quote:
Call  _diagramView.LoadFromString(workflowTemplate) method to load from string that is in xml format.


Where are you getting the workflowTemplate value from, server-side or client-side SaveToString call?
  
Back to top
 
IP Logged
 
Vitaliy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 7
Joined: Feb 13th, 2017
Re: Loaded from xml diagram opens in some view mode
Reply #4 - Feb 24th, 2017 at 3:15pm
Print Post  
I use client-side SaveToString, save that string to database, when I load page I read that value and write it to workflowTemplate variable. I try now save diagram with Silverlight and I can open diagram i "edit" mode by DiagramView. After that I save this diagram from DiagramView httlm page( client side) and open diagram in "read only" mode after that. I compare xml text after Silverlight and after DiagramView saving and see that after DiagramView saving xml text doesn't have  <ShowGrid>True</ShowGrid> for example.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Loaded from xml diagram opens in some view mode
Reply #5 - Feb 24th, 2017 at 6:16pm
Print Post  
The scripts attached above also implement saving grid properties from client side. If you call diagram.saveToString from JavaScript code, you'll need to use the new .js file to have ShowGrid saved.
  
Back to top
 
IP Logged
 
Vitaliy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 7
Joined: Feb 13th, 2017
Re: Loaded from xml diagram opens in some view mode
Reply #6 - Feb 27th, 2017 at 10:03am
Print Post  
I use js file attached above, but something wrong. I attach xml files of empty diagram saved with Silverlight and DiagramView client-side
  

Silverlight.txt ( 2 KB | 151 Downloads )
HtmlDiagram.txt ( 0 KB | 190 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Loaded from xml diagram opens in some view mode
Reply #7 - Feb 27th, 2017 at 12:54pm
Print Post  
So you have a very old Silverlight version of the control and want to exchange saved diagrams between it and the JavaScript / ASP.NET version? Note the format identifiers in XML files -

<Diagram Version="12"> in Silverlight
<Diagram Version="17"> in JavaScript

Generally we maintain backward compatibility for file formats but not forward one, so the older Silverlight version won't be able to load v17 format correctly, you might need to upgrade to latest Silverlight build if you need to move data from JavaScript to Silverlight.

Then the oldest format supported by JavaScript's loadFromXml is v13 (see Misc section in http://mindfusion.eu/Forum/YaBB.pl?num=1478545974) so it cannot load everything from the Silverlight file correctly either. We'll try to extend it one version back to support v12 format too in next few days. Until then you could use server-side LoadFromXml method to load older files - in .NET code we should have compatibility for even older formats.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Vitaliy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 7
Joined: Feb 13th, 2017
Re: Loaded from xml diagram opens in some view mode
Reply #8 - Feb 27th, 2017 at 1:58pm
Print Post  
I will redefine my question as this =>

This old version of XML (version=12) is loaded through asp.net back-end libraries(for backwards compatibility as you mentioned), and saving is done at client side with java-script which creates XML (version=17). Although grid options is set on aspx control like this:

Code (HTML)
Select All
  <Diagram RouteLinks="true" GridStyle="Lines" AlignToGrid="True" ShowGrid="True" GridColor="#1B000000" GridSizeY="10" GridSizeX="10">
                            </Diagram>
 



the diagram loaded (again through same mechanism) is missing grids on canvas. The only difference is that newer XML (version=17) missing such parameters as do older versions has.

So the question is what is needed to set (anywhere) that grid would be displayed?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Loaded from xml diagram opens in some view mode
Reply #9 - Feb 27th, 2017 at 2:31pm
Print Post  
The grid color saved in HtmlDiagram.txt is transparent (with 0 alpha value), our developer will investigate where it could come from.
<GridColor>#00000000</GridColor>

At this time you could reset GridColor from code after loading to show it.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Loaded from xml diagram opens in some view mode
Reply #10 - Feb 28th, 2017 at 11:51am
Print Post  
Our XML serializer wasn't parsing correctly rgba(...) strings, used to store colors with semi-transparency in .js library. This build should fix that -
https://mindfusion.eu/_beta/netdiag_xmlalpha.zip

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint