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

Custom Cell Viewer

1 Answer 6 Views
Grid
This is a migrated thread and some comments may be shown as answers.
None
Top achievements
Rank 1
None asked on 28 May 2015, 10:08 AM
I have a text area editor for a cell as follows:


function CommentsEditor(container, options) {
    console.log("CommentsEditor!!!");
    console.log(options.field);
    console.log(options);
    $('<textarea rows="4" cols="40" data-bind="value:' + options.field + '">'+ options.model.Comments  +' </textarea>')
    .appendTo(container)
        .kendoEditor();
}

    function ReadEditor(input) {        
           // $('<textarea rows="4" cols="40" ">' + input.Comments + ' </textarea>').kendoEditor(); CANT DO THIS!
 
            return '<textarea rows="4" cols="40" ">' + input.Comments + ' </textarea>';
        }




This works fine when I edit the cell. But how do I make it so that VIEWING the cell looks the same? I want each row, even when it is not being edited, to display a text area.

The problem is I cannot figure out how to get "template:" to do this, as there seems to be no way for me to call the right jquery inside of the template for a field to make it a kendo text area instead of a normal text area. Any ideas?

    { field: "Comments", template: ReadEditor, editor: CommentsEditor, title: "Comments", format: "{0:c}", width: "200px" },

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 01 Jun 2015, 07:35 AM

Hello None,

 

You should initialize the editor on dataBound event. Here is an example - http://dojo.telerik.com/@rusev/owAFE

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
None
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or