Wrap a sentence in multiple lines in a List or Library column

Hi there,

In the following "Action Item" column in the List or Library control, I want to wrap a sentence in multiple lines instead of one line like below. How do I achieve that? Thank you.

Dear @jyou,
The length of the column automatically adjusts to fit the content, but user can drag the border and resize the column, and the size will be saved for this specific column.

However, you can also set column width with some JavaScript code:

fd.spRendered(function () {
    // set the List/Library control column width
    fd.control('SPDataTable1').ready().then(function(dt) {
        var widget = dt.widget;
        var column1 = widget.columns[1];
        widget.resizeColumn(column1, 500);
    });
});

@Nikita_Kurguzov ,

Thank you for answering. I tried to adjust the border of the column and it didn't work. I also tried the code below and it didn't work also. I still see the text on one line instead of on multiple lines. Please advise how I can format the long sentence into multiple lines in that column.

Dear @jyou,
Are you sure the code has worked? You can adjust the width (instead of 500) and select which column to resize (change index), for example:

fd.control('SPDataTable1').ready().then(function(dt) {
    var widget = dt.widget;
    var column1 = widget.columns[4];
    widget.resizeColumn(column1, 100);
});

Also, what type of column is it? I've tried it with Title, as an example, and here's the result:
image

1 Like

@Nikita_Kurguzov Thank you for your support.

1 Like

Is there a way to detect the overall width of the control? Then the columns could be adjusted by percentage. Or is there another way to use the resizeColumn with percentage?

1 Like

Dear @cwalter2,
You can try the following JS to get width of the List or Library control:

fd.control('SPDataTable1').$el.offsetWidth;