Try our conversational search powered by Generative AI!

Complex property using Dojo and JSON

Vote:
 

Hi 

I'm trying to create a complex property using the dojo framework. The general implementation is

1. New property with a list of object. Inherits from PropertyLongString. The value is passed in as a JSON string and is serialised/deserialised in and out of the actual object. The store is the JSON string

2. A dojo editor. This passes the json string back to EPiServer via the onChange event. This should alert the page that the control has been changed and the value should fire back to the custom property. It doesn't work. The change fires but EPiServer doesn't recognise it

So the general question is - can i use the Dojo architecture to save an object - the object being passed back from the Dojo editor component as a json string (or the object). Does that pattern work

OR more generally

I've a requirement for a long flexible list of name value items. You can add any number in. I want to implement with Dojo - how should I do it. The above json way or another.

(I can think of two other ways -

1. use a string array and seperate the name value pairs with | symbols - a bit ugly

2. or use blocks as the items but is this possible??

)

Many Thanks for any all help

 

 

#82906
Mar 21, 2014 10:26
Vote:
 

Can i simplify this. 

Does anyone have an example/tutorial of an EPiServer control that can have a flexible number of name values pairs e.g. display text, value. Like the content link list control but coded in Dojo.

I'm starting to think that this is impossible. Please prove me wrong.

Thanks

#82950
Edited, Mar 21, 2014 17:50
Vote:
 

Hi Tim

I am working on a similar problem and found this very helpful (http://epideveloper.blogspot.co.uk/2013/10/episerver-7-custom-property-combined.html). However, it breaks when you want to reload the properties in the editor (its to do with dojo events/methods called before the div thats req. to populate exists.). I've posted both here and on Peter's blog but still awaiting reply.

#83048
Mar 25, 2014 10:49
Vote:
 

Thanks for that - looks really useful

I've actually taken the (relatively) easy way out. I've changed the backing property to a string. So the value collection is just stringified and stashed in there. 

Ideally the property would have been an object but when the onChange dojo event was fired - EPiServer wouldn't recognise it and never flagged the page for publish. It does work if the property is a string

 

 

#83196
Mar 27, 2014 12:51
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.