Sending settings from the server to your editor
I got a question how you can send settings that are defined on the server to an editor. It’s really quite simple so lets have a look on a simple example. We start by defining an editor descriptor and adding an entry in the EditorConfiguration dictionary:
[EditorDescriptorRegistration(TargetType = typeof(string), UIHint = "author")]
public class AuthorEditorDescriptor : EditorDescriptor
{
public AuthorEditorDescriptor()
{
ClientEditingClass = "alloy.editors.AuthorSelector";
EditorConfiguration["foo"] = "bar";
}
}
The settings in the EditorConfiguration dictionary is mixed on to the editor instance when started so you can access these settings as they were regular properties of your editor. This sample checks the value of foo in the postCreate-method:
postCreate: function () {
if (this.foo === "bar") {
alert("Happy happy joy");
}
},
And when the editor starts we get:
Comments