We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Wrap text of width fixed column

Hi,

So I have my grid with fixed width columns but if the text inside the cells is too long I want it to be wrap into 2 lines. By default it will just short the text and add '...' at the end.

There is some config I'm missing to set that?


thanks


2 Replies

TP Tamilarasan Paranthaman Syncfusion Team December 9, 2022 01:01 PM UTC

Hi Ezequiel,


We suspect that you set the Text.overflow property as TextOverflow.ellipsis for the row cell in the buildRow method. You can achieve your requirement by removing Text.overflow from the Text widget. Also, you can set how many lines of text should be wrapped using the Text.maxLines. We have prepared a sample for that. Please check the following sample and code snippet.


class EmployeeDataGridSource extends DataGridSource {

 

 

  @override

  DataGridRowAdapter buildRow(DataGridRow row) {

    return DataGridRowAdapter(

        cells: row.getCells().map<Widget>((DataGridCell dataCell) {

      return Container(

        padding: const EdgeInsets.symmetric(horizontal: 8.0),

        alignment: Alignment.centerLeft,

        child: Text(

          dataCell.value.toString(),

        ),

      );

    }).toList());

  }

}


Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample1442141151



We hope this helps. Please let us know if you need any further assistance on this.


Regards,

Tamilarasan



EB Ezequiel Bertran December 12, 2022 12:02 PM UTC

It was that, thanks


Loader.
Live Chat Icon For mobile
Up arrow icon