JOINT JS JSON

587 views
Skip to first unread message

Gabriel Carreras Albiol

unread,
Jun 13, 2016, 8:01:30 AM6/13/16
to JointJS
Hi There , I'm trying to implement JOINT JS, is posible to have two buttons on the graph, one for saving the full object graph (convert to JSON) and other button to "load" a JSON previously encoded?? here is my exsiting code, in modals I can change node names, I would like to have a full json file with new names aplied...
test2.html

Vladimír Talaš

unread,
Jun 14, 2016, 9:19:44 AM6/14/16
to joi...@googlegroups.com
Hi Gabriel, 

var jsonData = graph.toJSON() for export, graph.fromJSON(jsonData) for import.  

Regards, 



On Mon, Jun 13, 2016 at 2:01 PM, Gabriel Carreras Albiol <bcar...@gmail.com> wrote:
Hi There , I'm trying to implement JOINT JS, is posible to have two buttons on the graph, one for saving the full object graph (convert to JSON) and other button to "load" a JSON previously encoded?? here is my exsiting code, in modals I can change node names, I would like to have a full json file with new names aplied...

--

---
You received this message because you are subscribed to the Google Groups "JointJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jointjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Vladimir Talas
Client IO

Gabriel Carreras Albiol

unread,
Jun 14, 2016, 10:03:43 AM6/14/16
to JointJS
Hi Vladimir, excellent as always I'll test it out... regarding elements in Rappid, can we make one element (shape) some kind of "read only" with no attributes editable on inspector??
Thanks

Vladimír Talaš

unread,
Jun 15, 2016, 3:56:15 AM6/15/16
to joi...@googlegroups.com
Hi, 

Thanks to colleague of mine I can provide a solution. There is a config file for Inspector, there are defiitions for all shapes - fields which should be displayed in inspecter and theirs properties. There you can set the readonly attribute. In example below is setting for basic.Rect, fields 'font-size', 'text' will be readonly. You need to check in HTML how particular field is rendered and set readonly attr on right element. 

'basic.Rect': {
inputs: {
attrs: {
text: {
text: {
type: 'textarea',
label: 'Text',
group: 'text',
index: 1,
attrs: { textarea: { readonly: true } }
},
'font-size': {
type: 'range',
attrs: { input: { readonly: true } },
min: 5,
max: 80,
unit: 'px',
label: 'Font size',
group: 'text',
index: 2
}, 
Another option which 'disable' wole inspector is set CSS portiner-events: none' 

.joint-inspector {    pointer-events: none;} 
Regards, 

Reply all
Reply to author
Forward
0 new messages