Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] #1043

Open
icred-raul opened this issue Apr 15, 2024 · 1 comment
Open

[Bug] #1043

icred-raul opened this issue Apr 15, 2024 · 1 comment
Labels
bug Something isn't working stale This issue is stale because it has been open for 30 days with no activity.

Comments

@icred-raul
Copy link

Steps to reproduce the bug

  1. Set infinite scroll on pluto grid mobile
  2. Try to scroll infinitely

Expected results

Scroll infintely on mobile platform too. I had tested on web and worked very well.

Actual results

Gravacao.de.Tela.2024-04-15.as.15.39.36.mov

Code sample

return PlutoGrid(
    mode: PlutoGridMode.selectWithOneTap,
    createFooter: (stateManager) {
      return PlutoInfinityScrollRows(
        fetch: fetch,
        stateManager: stateManager,
        initialFetch: true,
        fetchWithFiltering: true,
        fetchWithSorting: true,
      );
    },
    onLoaded: (event) {
      store.setListExportStateManager(event.stateManager);
    },
    onSelected: (event) {
      if (event.row?.cells['isFinished']?.value) {
        _showMenu(
          context: context,
          uuid: event.row?.cells['uuid']?.value,
        );
      }
    },
    configuration: const PlutoGridConfiguration(
      localeText: PlutoGridLocaleText.brazilianPortuguese(),
    ),
    columns: GridListExportMobile()._columns,
    rows: GridListExportMobile().rows(
      export: store.listExport,
    ),
  );
  
  
  Future<PlutoInfinityScrollRowsResponse> fetch(
  PlutoInfinityScrollRowsRequest request,
) async {
  final store = GetIt.I.get<ListExportsStore>();

  final filterModel = {
    if (store.startDate != null && store.endDate != null)
      "startDate": FilterModelDart(
        filterType: 'dateTime',
        type: 'inRange',
        dateFrom: store.startDate?.startDateFormattedToBack,
        dateTo: store.endDate?.endDateFormattedToBack,
      ).toJson(),
    if (store.startDate != null)
      "startDate": FilterModelDart(
        filterType: 'dateTime',
        type: 'greaterThanOrEqual',
        dateFrom: store.startDate?.startDateFormattedToBack,
      ).toJson(),
    if (store.uuid != null && store.uuid!.isNotEmpty)
      "uuid": FilterModelDart(
        type: 'equals',
        filterType: 'text',
        filter: store.uuid,
      ).toJson(),
    if (store.cpf != null && store.cpf!.isNotEmpty)
      "createPerson.code": FilterModelDart(
        type: 'equals',
        filterType: 'text',
        filter: store.cpf != null
            ? UtilBrasilFields.removeCaracteres(store.cpf!)
            : null,
      ).toJson(),
  };

  final repository = GetIt.I.get<ExportRepository>();

  final result = await repository.exportList({
    "startRow": request.filterRows.length * 10,
    "endRow": request.filterRows.length * 10,
    "sortModel": [
      {"sort": "desc", "colId": "startDate"}
    ],
    "filterModel": filterModel,
  });

  final rows = (result['rowData'] as List)
      .map((e) => ExportModelResponse.fromJson(e))
      .toList();

  return PlutoInfinityScrollRowsResponse(
    isLast: false,
    rows: GridListExportMobile().rows(export: rows),
  );
}

Execution Environment

Flutter version

PlutoGrid version

OS

@icred-raul icred-raul added the bug Something isn't working label Apr 15, 2024
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale This issue is stale because it has been open for 30 days with no activity. label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale This issue is stale because it has been open for 30 days with no activity.
Projects
None yet
Development

No branches or pull requests

1 participant