Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic SetBehavior not working (Read 3614 times)
RJ
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 27
Joined: Sep 4th, 2015
SetBehavior not working
Sep 22nd, 2015 at 1:35pm
Print Post  
setBehavior is not working when MicrosoftAjax script is included to import/export JSON.

Can you please tell me a way to make this work with ajax script?

Thanks,
Raji
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SetBehavior not working
Reply #1 - Sep 22nd, 2015 at 2:39pm
Print Post  
Do you mean setBehavior no longer switches behaviors correctly if you just load MicrosoftAjax.js? Or it doesn't do what you expect after you load objects from custom Json data, or calling diagram's built-in toJson/fromJson methods?
  
Back to top
 
IP Logged
 
RJ
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 27
Joined: Sep 4th, 2015
Re: SetBehavior not working
Reply #2 - Sep 23rd, 2015 at 5:22pm
Print Post  
It doesnt work after i load data from JSON file.

Thanks,
Raji
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SetBehavior not working
Reply #3 - Sep 23rd, 2015 at 5:31pm
Print Post  
If you are using the built-in toJson and fromJson methods, you might be loading older Behavior value overwriting your current one, as Behavior is serialized in Json too. If you have custom code for parsing Json data, please attach a test page showing the problem.
  
Back to top
 
IP Logged
 
RJ
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 27
Joined: Sep 4th, 2015
Re: SetBehavior not working
Reply #4 - Sep 23rd, 2015 at 5:40pm
Print Post  
I am using the built-in toJSON/fromJSON. So how can i overcome this problem?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SetBehavior not working
Reply #5 - Sep 23rd, 2015 at 5:47pm
Print Post  
If you need Behavior to correspond to some current value from the UI, e.g. a combo box, you will have to reset it after calling fromJson:

Code
Select All
diagram.fromJson(json);
diagram.setBehavior(behaviorCombo.value); 



or save and restore it:

Code
Select All
var currentBehavior = diagram.getBehavior();
diagram.fromJson(json);
diagram.setBehavior(currentBehavior); 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint