editor & dataSource
HTML
<script src="http://cdn.kendostatic.com/2012.1.515/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.1.322/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.1.322/styles/kendo.default.min.css">
<textarea id="editor"></textarea>
<input type="button" id="btnFill" value="Insert Content" onclick="insert();" />
CSS
textarea {
width: 100%;
height: 350px;
}
JavaScript
var dataSource = new kendo.data.DataSource({
transport: {
read: {
//using jsfiddle echo service to simulate JSON endpoint
url: "/echo/json/",
dataType: "json",
type: "POST",
data: {
// /echo/json/ echoes the JSON which you pass as an argument
json: [
{"MSDescription":"<i>content from dataSource</i>"}
])
}
}
}
});
$("#editor").kendoEditor();
dataSource.read(); //reads the dataSource
function insert() {
var editor = $("#editor").data("kendoEditor"); //reference the editor
var content = dataSource.at(0).MSDescription;
editor.value(content);
}