View unanswered posts | View active topics It is currently 2018-07-21 17:48



Reply to topic  [ 8 posts ] 
 twaver反序列问题 
Author Message
新手上路

Joined: 2017-06-01 17:02
Posts: 42
Post twaver反序列问题
我想一开始就通过反序列加载出我要的节点,例如demo,LinkEditorDemo.html,它的右边部分是在initBox中画出来的,而我想通过我保存在数据库的json数据,让它显示出来?我在initBox中如下写的
initBox function(){
var network = new twaver.network.Network();
network.setLinkFlowEnabled(true);
network.setLinkFlowInterval(100);
var box = network.getElementBox();
var alarmBox = box.getAlarmBox();
$.ajax({
type:"post",
data: {
"pageIndex": 0,
"refreshFlag": 1,
"pk_scene_id":"dafb76df8b93496993205f8191db827d"
},
url:path,
success:function(data) {
twaver.SerializationSettings.setPropertyType('id', 'string');
new twaver.JsonSerializer(box).deserialize(data.data);
}
});
}
然后在初始化的调用了这个方法,initBox(path);也得到了响应值,如下:
data {"version":"5.8.3","platform":"html5","images":{},"dataBox":{"class":"twaver.ElementBox","layers":[{"name":"Default","visible":true,"editable":true,"movable":true}]},"datas":[{"class":"twaver.Node","ref":0,"p":{"image":"linux","location":{"x":137,"y":64}},"id":"CEB2A5D469BC4E4A8765B7297940F9E7"},{"class":"twaver.Node","ref":1,"p":{"image":"centos","location":{"x":139,"y":173}},"id":"10750E68BED341ACA49A7785B931CC0A"},{"class":"twaver.Node","ref":2,"p":{"image":"VLAN","location":{"x":441,"y":214}},"id":"D58D822C99394DE2845AE8D3BC2B7325"}]}
但是它就是在右边不显示出来节点,怎么回事?


2018-07-12 17:26
Profile
TWaver开发组
User avatar

Joined: 2018-04-16 16:11
Posts: 64
Post Re: twaver反序列问题
很抱歉,看您贴的这一段代码,暂时无法定位问题所在。

network的父div添加到页面中去了吗?如果添加了,检查一下,有没有什么地方写错了。您可以以先自己调试一下,定位问题所在。


2018-07-12 18:03
Profile
新手上路

Joined: 2017-06-01 17:02
Posts: 42
Post Re: twaver反序列问题
附件:是demo,麻烦帮我解决一下,我找不到原因了,谢谢!


Attachments:
test12.rar [345.34 KiB]
Downloaded 7 times
2018-07-13 15:36
Profile
新手上路

Joined: 2017-06-01 17:02
Posts: 42
Post Re: twaver反序列问题
有没有解决办法啊,很着急?


2018-07-16 16:38
Profile
TWaver开发组
User avatar

Joined: 2018-04-16 13:27
Posts: 22
Post Re: twaver反序列问题
邮件已回复
Attachment:
test1.zip [1.31 MiB]
Downloaded 2 times


2018-07-16 16:41
Profile
新手上路

Joined: 2017-06-01 17:02
Posts: 42
Post Re: twaver反序列问题
中文保存在库里,取出来乱码什么原因?


2018-07-18 8:56
Profile
TWaver开发组
User avatar

Joined: 2018-04-16 13:27
Posts: 22
Post Re: twaver反序列问题
您看一下<head>是否是未添加<meta charset = "UTF-8">


Attachments:
乱码.png
乱码.png [ 38.28 KiB | Viewed 51 times ]
2018-07-18 9:30
Profile
新手上路

Joined: 2017-06-01 17:02
Posts: 42
Post Re: twaver反序列问题
加上就好了,谢谢!


2018-07-18 11:13
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron