Auto calc of row heights when using GridWidgetColumn

Hi,
I am currently reviewing the use of the sfDataGrid and wishing to autosize the row height (making it vary upon the content).  I can see that this is working correctly with the code below where I have multi-line text in a column for example; but I have not been able to work out how to achieve this using the GridWidgetColumn.  
I have a widget that is returning a variable amount of formatted text in a container for example.

Could you confirm if support is provided for variable sized widgets and onQueryRowHeight.

Many thanks in advance
Ian.
--
CODE SNIP;
columnSizer: _columnSizer,
onQueryRowHeight: (RowHeightDetails rowHeightDetails) {
  if (rowHeightDetails.rowIndex == 0)
    return rowHeightDetails.rowHeight;
  else
    return _columnSizer.getAutoRowHeight(rowHeightDetails.rowIndex);
},


3 Replies

RS Renugadevi Sadagoban Syncfusion Team March 30, 2021 01:49 PM UTC

Hi lan,   
  
Greetings from syncfusion.   
  
Currently, SfDataGrid does not have support for autofit (width and height) for the widget column. Initially, the default width is set to the widget column unless you have not set the width to the widget column. We have considered this feature “Support to autofit the widget column based on widget loaded inside it”. This feature will be implemented in our any of our upcoming release. 
  
Please refer the below feedback link for further follow up,   
We appreciate your patience until then. For further assistance you can follow the feature request.   
  
Regards,  
Renuga devi S  



IA Ian April 20, 2021 02:33 PM UTC

Hi Renuga,

I'm just following this item back up if OK; as I am starting to implement the autofit - but for text only this time, rather than a widget.
I was planning on making the text element multi-lined (including the \n) - but I am wondering if this is now not available...?
Since I first looked at this; the new release came out.

In trying to use the code I had before; the ColumnSizer type cannot be located...?
Without using this; I am not able to do a getAutoRowheight.

If you can confirm if this is available in a different method - that would be great.

Kind regards
Ian.

final ColumnSizer _columnSizer = ColumnSizer();

return SfDataGridTheme(
  data: SfDataGridThemeData(
        gridLineColor: Colors.black38, gridLineStrokeWidth: 0.5),
        child: SfDataGrid(
          columnWidthMode: ColumnWidthMode.fill,
          columnSizer: _columnSizer,
          onQueryRowHeight: (RowHeightDetails rowHeightDetails) {
            if (rowHeightDetails.rowIndex == 0)
              return rowHeightDetails.rowHeight;
            else
              return _columnSizer.getAutoRowHeight(rowHeightDetails.rowIndex);
           },


RS Renugadevi Sadagoban Syncfusion Team April 21, 2021 09:23 AM UTC

Hi Ian,  
 
Thanks for contacting Syncfusion support.  
 
We have made API breaking changes in 2021 Volume 1 release. As per the new API paradigm, we are getting the widgets directly from users. Due to this, SfDataGrid does not have support for autofit (width and height) for the column.   
 
Please refer to the following blog for API breaking changes,  
 
We have already considered the autofit for the row and column feature and logged the feature request. This feature will be implemented in our any of our upcoming release.  
 
Please refer to the below feedback link for further follow up,  
 
We appreciate your patience until then. For further assistance, you can follow the feature request.  
  
Regards, 
Renuga devi S 


Loader.
Up arrow icon