How to show text "data is empty" inside sfgrid?

How to show text "data is empty" inside sfgrid if data from server empty?table.PNG


6 Replies 1 reply marked as answer

SR Sangeetha Raju Syncfusion Team November 8, 2021 01:37 PM UTC

Hi Asep,  
  
Thank you for contacting Syncfusion support.  
  
You can display information through the footer property in DataGrid. You can set the text widget to footer property and display it whenever you are receiving the empty collection from the server. Also, you can use the footerHeight property to set different height. Please refer to the following code snippet,  
  
  
@override  
  Widget build(BuildContext context) {  
    return Scaffold(  
        appBar: AppBar(title: const Text('SfDataGrid Demo')),  
        body: SfDataGrid(  
            source: _employeeDataGridSource,  
            columnWidthMode: ColumnWidthMode.fill,  
            footer: _employeeDataGridSource.rows.isEmpty  
                ? Container(  
                    color: Colors.lightBlue[50],  
                    child: const Center(child: Text('Data is empty')))  
                : null,  
            columns: [  
              GridColumn(  
                  columnName: 'id',  
                  autoFitPadding: const EdgeInsets.symmetric(horizontal: 16.0),  
                  label: Container(  
                      padding: const EdgeInsets.symmetric(horizontal: 16.0),  
                      alignment: Alignment.centerRight,  
                      child: const Text(  
                        'ID',  
                        overflow: TextOverflow.ellipsis,  
                      ))),  
              GridColumn(  
                  columnName: 'name',  
                  autoFitPadding: const EdgeInsets.symmetric(horizontal: 16.0),  
                  label: Container(  
                      padding: const EdgeInsets.symmetric(horizontal: 16.0),  
                      alignment: Alignment.centerLeft,  
                      child: const Text(  
                        'Name',  
                        overflow: TextOverflow.ellipsis,  
                      ))),  
              GridColumn(  
                  columnName: 'designation',  
                  autoFitPadding: const EdgeInsets.symmetric(horizontal: 16.0),  
                  label: Container(  
                      padding: const EdgeInsets.symmetric(horizontal: 16.0),  
                      alignment: Alignment.centerLeft,  
                      child: const Text(  
                        'Designation',  
                        overflow: TextOverflow.ellipsis,  
                      ))),  
              GridColumn(  
                  columnName: 'salary',  
                  autoFitPadding: const EdgeInsets.symmetric(horizontal: 16.0),  
                  label: Container(  
                      padding: const EdgeInsets.symmetric(horizontal: 16.0),  
                      alignment: Alignment.centerRight,  
                      child: const Text(  
                        'Salary',  
                        overflow: TextOverflow.ellipsis,  
                      ))),  
            ]));  
  }  
  
We have prepared the sample for your reference. Please find the sample from the following link.  
  
  
Please let us know if you require any further information.  
  
Regards,  
Sangeetha Raju.  
  


Marked as answer

AS asep November 9, 2021 03:33 AM UTC

Thank you so much, its work



SR Sangeetha Raju Syncfusion Team November 9, 2021 05:37 AM UTC

Hi Asep, 


Thank you for the update. 


We are glad to know that the reported problem has been resolved at your end. Please let us know if you need further assistance. As always, we are happy to help you out. 


Regards, 

Sangeetha Raju. 



HM hariom mandloi March 22, 2025 01:24 PM UTC

I want to show data is empty if no data  after filtering a column, even rows not empty



AP Abinesh Palanisamy Syncfusion Team March 24, 2025 12:05 PM UTC

Hi hariom,
 

As of now, the DataGrid does not support displaying an empty message when there are no rows. However, we have already considered your request as a feature and plan to implement it in a future release. During the planning stage of each release cycle, we review all open feature requests and prioritize them based on factors such as product vision, technological feasibility, and customer interest. We appreciate your patience and understanding in the meantime. For further details, you can follow up using the feedback link below.


Feedback link: 50967


Regards,

Abinesh P



AP Abinesh Palanisamy Syncfusion Team March 27, 2025 03:50 AM UTC

Hi hariom,

We are glad to announce that our Essential Studio® 2025 Volume 1 Main Release V29.1.33 is rolled out with the enhancement of “showing an empty message when the row count is zero” and is available for download under the following link.

Essential Studio® 2025 Volume 1 Main Release v29.1.33 is available for download | Announcements Forums | Syncfusion®

UG - Placeholder in Flutter DataGrid | DataTable | Syncfusion

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

Regards,

Abinesh P


Loader.
Up arrow icon