bosskmk / pluto_grid

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.
https://pluto.weblaze.dev
MIT License
636 stars 290 forks source link

[Help] When Columns and Rows from server using fetched Data, But No Effects to Screen #1023

Closed YongHyeonLeeKr closed 2 months ago

YongHyeonLeeKr commented 4 months ago

When Dubuged, fetchedRows and columns fetchedColumns i could found that Data from server successfully downloaded and conversioned type (List, List<PlutoColumn)

image

But no Effectss to table on Screen image

Here's full Code

What makes this Error? Plz let me knwo

import 'package:flutter/material.dart';
import 'package:pluto_grid/pluto_grid.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';

import 'ApiService.dart';

class JsonPlutoGrid extends StatefulWidget {

  @override
  State<JsonPlutoGrid> createState() => _JsonPlutoGridState();

}

class _JsonPlutoGridState extends State<JsonPlutoGrid> {

   late List<PlutoRow> rows= [];
   late List<PlutoColumn> columns= [];

  @override
  initState() {
    super.initState();
   // _loadData();

  }

  _loadData() async {
    var fetchedRows = await  ApiService().get_Rows();
    var fetchedColumns = await ApiService().get_Columns();
    setState(() {
      rows = fetchedRows ;
      columns = fetchedColumns;

    });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        padding: const EdgeInsets.all(30),
        child:  PlutoGrid(
          columns: columns,
          rows:rows,
          onLoaded: (PlutoGridOnLoadedEvent event) {
            // 그리드가 로드되면 수행할 작업
            _loadData();
            print('onLoaded');

          },
        ),
      ),
    );
  }
}
design2023 commented 4 months ago

You have to use stateManager from the event : event.stateManager to set the new column and the rows.

github-actions[bot] commented 3 months ago

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

github-actions[bot] commented 2 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.