EditorImmutablesSettingsBuilder
Methods
Serialization(System.String)
Kendo template or a callback that allows custom serialization of an immutable element. The callback accepts DOM element as only parameter and is expected to return the HTML source of a DOM element.
Parameters
value - System.String
The value that configures the serialization.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Immutables(immutables =>
immutables.Serialization("<#= data.nodeName # data=\"immutable-element\"></#= data.nodeName #>");
)
)
SerializationHandler(System.String)
Defines a callback that allows custom serialization of an immutable element. The callback accepts DOM element as only parameter and is expected to return the HTML source of a DOM element.
Parameters
handler - System.String
The name of the JavaScript function that will be evaluated.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Immutables(immutables =>
immutables.SerializationHandler("immutablesSerialization");
)
)
<script>
function immutablesSerialization(node) {
var tagName = node.tagName;
return "<" + tagName + ">" + </" + tagName + ">";
}
</script>
SerializationHandler(System.Func)
Defines a callback that allows custom serialization of an immutable element. The callback accepts DOM element as only parameter and is expected to return the HTML source of a DOM element.
Parameters
handler - System.Func<Object,Object>
The handler code wrapped in a text tag.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.Immutables(immutables =>
immutables.SerializationHandler(@<text>
function(node) {
var tagName = node.tagName;
return "<" + tagName + ">" + </" + tagName + ">";
}
</text>)
)
)
Deserialization(System.String)
Defines a callback that allows custom deserialization of an immutable element. The callback accepts two arguments. The DOM element representing the immutable element in the html view and the immutable DOM element, which will be restored.
Parameters
handler - System.String
The name of the JavaScript function that will be evaluated.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Immutables(immutables =>
immutables.Deserialization("immutablesDeserialization");
)
)
<script>
function immutablesDeserialization(node, immutable) {
immutable.style.backgroundColor = "red";
}
</script>
Deserialization(System.Func)
Defines a callback that allows custom deserialization of an immutable element. The callback accepts two arguments. The DOM element representing the immutable element in the html view and the immutable DOM element, which will be restored.
Parameters
handler - System.Func<Object,Object>
The handler code wrapped in a text tag.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.Immutables(immutables =>
immutables.Deserialization(@<text>
function(node, immutable) {
immutable.style.backgroundColor = "red";
}
</text>)
)
)