Sameer Shinde
Sameer Shinde

Reputation: 37

Multiline support in Kendo UI Grid

I am having a column with following definition in Kendo UI Grid

fields: {
        column1: {type:"string",editable: false},
}

columns: [
{field: "column1",title:"Column1",width: 600}, 
]

The column is having VARCHAR2(4000) as a data size in DB and can have huge data with few paragraphs. Obviously it is having more than one lines.

The column when entered is being stored in DB with carriage returns and special characters.

But when it is rendered in Kendo UI Grid all the characters appear in single line.

For editing I can apply textarea editor and multiple lines can be viewed.

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

But, how to display the data in multi-lines for this column when viewed in grid?

Tried searching this on dev forums but haven't got any faithful inputs.

Do suggest any links/pointers for the same.

Upvotes: 0

Views: 4656

Answers (1)

Richard
Richard

Reputation: 109025

Style the cells with white-space: pre-line. This will collapse most whitespace, but line break at newlines (plus on <br/>).

Upvotes: 3

Related Questions