This is a migrated thread and some comments may be shown as answers.

Unable to display dynamic content in a editor using datasource

1 Answer 147 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
durga bhavani
Top achievements
Rank 1
durga bhavani asked on 07 Jun 2012, 09:28 AM
Hi all,
I am passing an json object from the controller.The json object is string format of a document file.I need to place the content of the doc file in the editor dynamically.
I am passing string object through json .In my schema of the datasource i tried to display using s:{type:"string"}
Here s is the json object.But i am unable to display the content.
Could you please provide me any sample or example on how to place a dynamic content in a editor using datasource.
Thanks & Regards

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 11 Jun 2012, 02:32 PM
Hello Durga,

To achieve that I suggest to use the value method, for example:
function insert() {
    //reference the editor
    var editor = $("#editor").data("kendoEditor");
    //retrieve the content value from dataSource
    var content = dataSource.at(0).text;
    //replace the editor value
    editor.value(content);
}

In order to illustrate this approach I prepared a small example, please note that it is required to read the dataSource before insert function is called else the content will be undefined.
I hope this helps.

All the best,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
durga bhavani
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or