Sorting and filtering doesn't work

The sort flag is set to true. When sorting from 'a' to 'z' is applied, the results are sorted according to an unknown algorithm.


Only sorting by row number works fine.
All data (except row number) are fetched from API via future methods.

Filtering also works only for row number:



For the other columns they do not work..


1 Reply

TP Tamilarasan Paranthaman Syncfusion Team March 10, 2023 07:11 AM UTC

Hi Damian,


We have reviewed the information you provided, but we were not able to reproduce the reported issue from our end. As the sorting and filtering are working properly on our end, we suspect that the issue may be specific to the sample level. To assist you better, could you please provide us with more detailed information about how you fetch the data from the API and assign it to the DataGrid? It would also be helpful if you can confirm that you’re setting the same column name on the GridColumn.columnName and DataGridCell.columnName in DataGridRow. We have attached a sample that we tested, along with an output video reference. If possible, could you please provide the sample you are having trouble with? Alternatively, you can modify the attached sample to be reproducible, so we can investigate and provide a solution as soon as possible.

  List<GridColumn> get getColumns {

    return [

      GridColumn(

          columnName: 'id',

          label:

              Container(alignment: Alignment.center, child: const Text('ID'))),

      GridColumn(

          columnName: 'name',

          label: Container(

              alignment: Alignment.center, child: const Text('Name'))),

      GridColumn(

          columnName: 'designation',

          label: Container(

              alignment: Alignment.center, child: const Text('Designation'))),

      GridColumn(

          columnName: 'salary',

          label: Container(

              alignment: Alignment.center, child: const Text('Salary'))),

    ];

  }

 

class EmployeeDataSource extends DataGridSource {

  EmployeeDataSource(List<Employee> employees) {

    buildDataGridRow(employees);

  }

 

  void buildDataGridRow(List<Employee> employeeData) {

    dataGridRow = employeeData.map<DataGridRow>((employee) {

      return DataGridRow(cells: [

        DataGridCell<int>(columnName: 'id', value: employee.id),

        DataGridCell<String>(columnName: 'name', value: employee.name),

        DataGridCell<String>(

            columnName: 'designation', value: employee.designation),

        DataGridCell<int>(columnName: 'salary', value: employee.salary),

      ]);

    }).toList();

  }

}


Regards,

Tamilarasan


Attachment: sample_81901f46.zip

Loader.
Up arrow icon