Articles in this section
Category / Section

How to add fixed header (freeze panes) in Flutter DataTable (SfDataGrid)?

4 mins read

The Syncfusion Flutter DataTable widget provides the support to set the fixed header is also known as freeze rows (top and bottom) or columns (right and left) by using following properties,

The freeze row and freeze column are shown with the elevation effect. You can change the elevation value in SfdataGridThemeData using frozenPaneElevation property.

Fixed header (Freeze rows)

The rows can be frozen in view at top and bottom by setting the frozenRowsCount and footerFrozenRowsCount properties.

 

  
@override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('Freeze Pane Demo'),
        ),
        body: SfDataGrid(
            source: freezePanesDataGridSource,
            frozenRowsCount: 1,
            columns: getColumns()));
  }
 

 

freeze rows at top in syncfusion flutter datatable

 

The following code example shows how to freeze a row at bottom by setting the footerFrozenRowsCount property.

 

 
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('Freeze Pane Demo'),
        ),
        body: SfDataGrid(
            source: freezePanesDataGridSource,
            footerFrozenRowsCount: 1,
            columns: getColumns()));
  }
 

 

footer freeze rows at bottom in syncfusion flutter datatable

 

Fixed column (Freeze column)

The columns can be frozen in view at left and right by setting the frozenColumnsCount and footerFrozenColumnsCount properties.

 

 
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('Freeze Pane Demo'),
        ),
        body: SfDataGrid(
            source: freezePanesDataGridSource,
           frozenColumnsCount: 1,
            columns: getColumns()));
  }

 

frozen column at left in syncfusion flutter datatable

 

The following code example shows how to freeze a column at right by setting footerFrozenColumnsCount property.

 

  
@override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('Freeze Pane Demo'),
        ),
        body: SfDataGrid(
            source: freezePanesDataGridSource,
            footerFrozenColumnsCount: 1,
            columns: getColumns()));
  }

 

frozen column at right in suncfusion flutter datatable

 

You can click this link to know more about freeze panes feature.

 

Conclusion

I hope you enjoyed learning about how to add fixed header in Flutter DataTable (SfDataGrid).

You can refer to our Flutter DataGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our  Flutter DataGrid example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied