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

multiline textarea in a grid, databinding

3 Answers 2015 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jan Houwen
Top achievements
Rank 1
Jan Houwen asked on 14 Mar 2013, 11:36 AM
I want to include a multiline textarea in a grid. I've tried to do that like this sample, by adding an 'editor' property to a  kendoGrid columns field, and defining an initializer function.

columns: [
       field: "cont"
       editor: textEditorInitialize 
]

var textEditorInitialize = function(container, options) {
        $('<textarea style="width: ' + container.width() + 'px;height:' + container.height() + 'px" />')
        .appendTo(container);
};

The editor does not quite work as expected. A functional edit box is added to the grid, but in edit mode the field value is not bound, the edit box is empty.
After completing the edit, no change event is triggered, so the update method of the datasource is not invoked.

What could be wrong?

3 Answers, 1 is accepted

Sort by
1
Vladimir Iliev
Telerik team
answered on 18 Mar 2013, 11:25 AM
Hi Jan,

 
Basically current approach is valid, however to be able to bind the editor to the model you should include the name attribute which should contain the field name - please check the updated editor below:

var textEditorInitialize = function(container, options) {
    $('<textarea name="' + options.field + '" style="width: ' + container.width() + 'px;height:' + container.height() + 'px" />')
    .appendTo(container);
};

Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Shoeb
Top achievements
Rank 1
answered on 25 Jul 2016, 02:07 PM

Hi,

I want to implement the same in MVC grid. I am not sure how to use textEditorInitialize in MVC Kendo Grid.

I have already implemented as per the below post.

http://www.telerik.com/forums/set-height-on-multiline-textbox-in-mvc-grid-with-inline-editing.

 

Thanks,

Shoeb.

 

 

 

 

0
Vladimir Iliev
Telerik team
answered on 26 Jul 2016, 08:37 AM
Hi Shoeb,

Please note that the Editor MVC wrapper can be used as custom editor for given field as any other wrapper - for more information on the matter you can check the following help article:

Regards,
Vladimir Iliev
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Grid
Asked by
Jan Houwen
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Shoeb
Top achievements
Rank 1
Share this question
or