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

Grid create menu - Textarea

6 Answers 549 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carlos
Top achievements
Rank 1
Carlos asked on 23 Apr 2012, 05:29 AM
I need to enter a multiline text within the grid, any solution for this?


schema: {
                    data:"data",
                    total: "total",
                    model: {                        
                        id: "id",
                        fields: {                            
                             
   I need to enter multiline text in this field 
                            cont: { type: "string", name: "contenido", validation: { required: true } }

                        }
                    }
                    
                }

6 Answers, 1 is accepted

Sort by
0
Jonas
Top achievements
Rank 1
answered on 07 May 2012, 11:43 AM
Use a custom editor in your column definition:

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


...

var textEditorInitialize = function(container, options) {
        $('<textarea style="width: ' + container.width() + 'px;height:' + container.height() + 'px" />')
        .appendTo(container);
};
0
Jan Houwen
Top achievements
Rank 1
answered on 14 Mar 2013, 11:20 AM
I tried the given solution, to include an editor in a gridview.
The editor does not quite work as expected. 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?
 
0
Daniel
Telerik team
answered on 19 Mar 2013, 08:38 AM
Hi,

You should also specify the binding to the textarea in order for the editor to work correctly:

var textEditorInitialize = function(container, options) {
        $('<textarea data-bind="value:' + options.field + '" />')
        .appendTo(container);
};
Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jan Houwen
Top achievements
Rank 1
answered on 25 Mar 2013, 10:29 AM
Thanks Daniel for the reply.

I have tried to create the binding according to your sample, but this is not working.
What I can observe by adding watches in firebug is that the initializer function seems to be called with just the 'container' param, the 'options' param is undefined. So the  '....    data-bind="value:' + options.field  ..  '  fails.

 I'm using following versions of the libraries:

<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://cdn.kendostatic.com/2012.3.1114/js/kendo.all.min.js"></script>

Any idea?

0
Daniel
Telerik team
answered on 28 Mar 2013, 07:56 AM
Hi,

I have created a small jsBin example based on the Grid InLine editing demo that uses a textarea for the "ProductName" field. Please check it on this page and let me know if I am missing something.

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jan Houwen
Top achievements
Rank 1
answered on 28 Mar 2013, 09:45 AM
Thanks for the sample.

I've tried this and it works, and my initial setup, without an edit button, with a clickable inputfield, magically works too. (http://jsbin.com/itiyon/3/edit ) The firebug watch on the 'options' param of the textEditorInitialize function however still lists this param as 'undefined'. (ReferenceError: options is not defined). I'll try to scrutinize this.





Tags
Grid
Asked by
Carlos
Top achievements
Rank 1
Answers by
Jonas
Top achievements
Rank 1
Jan Houwen
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or