This does indeed save the value, and if I access the picker value elsewhere, the new object I've added will be shown, but it doesn't reflect in the property value in the backoffice. So if the node is saved in the backoffice (in my case the node is a member), it overwrites the value I have set in my code.
The question is, how do I correctly save values to an Xml PrefetchList Picker from code?
Saving JSON to Xml PrefetchList Picker
Hi,
I'm using the JSON save format for a member data type based on the Xml PrefetchList Picker nuPicker type.
In my code I use JSON.Net to deserialize the picker's value to a list of my custom type:
I then add a new object to my list:
And then serialize the list to save it back to the picker property:
This does indeed save the value, and if I access the picker value elsewhere, the new object I've added will be shown, but it doesn't reflect in the property value in the backoffice. So if the node is saved in the backoffice (in my case the node is a member), it overwrites the value I have set in my code.
The question is, how do I correctly save values to an Xml PrefetchList Picker from code?
Thanks, Rob
I solved my own problem if anyone is interested.
The myType class I had created needed to use lowercase property names, i.e. "key" and "label", rather than uppercase.
This will then create a JSON string that matches the format produced when the member is saved from the back office.
Rob
is working on a reply...