Data not loaded in filter

Hello,

i have a sfdatagrid with dynamic generation for my columns but since i switch to this (before i predefined the column name,...) , i have no data in the popup of the filter.


I don't know why because, my datas are loaded in my sfdatagrid and show but when i click on the filter button for opening the popup of filter => no matches .


My question is why and how can i fix this, and the second is :

At the moment, i'm loading the row by 25 but in my filter popup i want all of my data is average 50k like all of firstname in value for filtering, is it possible ?

Thanks for answering to me


Attachment: crm_9b369e97.zip

1 Reply

TP Tamilarasan Paranthaman Syncfusion Team March 11, 2024 01:25 PM UTC

Hi Jonathan,

Regarding: I have no data in the popup of the filter.

After analyzing the provided DataGrid configuration and DataGridSource, we identified a potential issue in your DataGridSource code. In the `DataGridSource.rows` method, you have set the `DataGridCell.columnName` as an empty string by default for all DataGridCell instances. It's crucial to set the proper column name, which corresponds to the respective `GridColumn.columnName`, in the `DataGridCell.columnName`. This is essential because filtering and sorting operations rely on the column name to function correctly.


Please review the following code snippet for reference:


class MyDataSource extends DataGridSource {

  final BuildContext context;

  final List<Map<String, dynamic>> data;

  final List<GridColumn> columns;

 

  MyDataSource(

      {required this.data, required this.context, required this.columns});

 

  @override

  List<DataGridRow> get rows {

    return data.map<DataGridRow>((rowData) {

      return DataGridRow(

          cells: columns.map<DataGridCell>((column) {

        return DataGridCell<dynamic>(

            value: rowData[column.columnName], columnName: column.columnName);

      }).toList());

    }).toList();

  }

}


We hope this clarification helps resolve the issue you are facing. Please verify this solution on your end and let us know if it resolves the problem. If you have any further inquiries or require additional assistance, please don't hesitate to reach out to us. We're always here to help.


Regarding: I want all of my data is average 50k like all of firstname in value for filtering, is it possible?

As of now, DataGrid does not have support for loading custom values in the filter pop-up menu. We have already logged the feature request regarding this. We will implement this feature in any of our upcoming releases. At the planning stage for every release cycle, we review all open features. We will let you know when this feature is implemented. You can follow up with the below feedback for further follow-up,


Feedback Link: 38552

Regards,

Tamilarasan


Loader.
Up arrow icon