2

I made a Datatable with Flutter looks like this:

enter image description here

The Code looks like this:

DataTable(
  columns: [
    DataColumn(
      label: Text('UID'),
      numeric: false,
      tooltip: "User ID",
    ), 
    DataColumn(
      label: Text('Name'),
      numeric: false,
      tooltip: "User Name",
    ),
    DataColumn(
      label: Text('Placeholder'),
      numeric: false,
      tooltip: "Placeholder",
    ),
  ], 
  rows: users.map(
    (user) => DataRow(
      cells: [
        DataCell(
          Text(user.uid),
          onTap: () {
            print('Clicked on: ${user.uid} : ${user.name}');
          },
        ),
        DataCell(
          Text(user.name)
        ),
        DataCell(
          Text('Placeholder')
        ),
      ]
    ),
  ).toList(),
),

So is it possible to get Child rows? Here is an example: https://datatables.net/examples/server_side/row_details.html

So I want that if you click on one of the rows a child row appears with more information (and buttons in the future).

Any help? Thanks in advance!

1

1 Answer 1

2

What about create a detailed page and then do following

DataTable(
  columns: [
    DataColumn(
      label: Text('UID'),
      numeric: false,
      tooltip: "User ID",
    ), 
    DataColumn(
      label: Text('Name'),
      numeric: false,
      tooltip: "User Name",
    ),
    DataColumn(
      label: Text('Placeholder'),
      numeric: false,
      tooltip: "Placeholder",
    ),
  ], 
  rows: users.map(
    (user) => DataRow(
      cells: [
        DataCell(
          Text(user.uid),
          onTap: () {
            print('Clicked on: ${user.uid} : ${user.name}');
          },
        ),
        DataCell(
          Text(user.name)
        ),
        DataCell(
          Row(
            children:<Widget> [
             IconButton(
    icon: Icon(Icons.arrow_right),
    tooltip: 'Show Details',
    onPressed: () {
      Navigator.push(detailapage,argument: user);
    },
  ),Text('Placeholder'),

           ]),
        ),
      ]
    ),
  ).toList(),
),
Sign up to request clarification or add additional context in comments.

1 Comment

Hmm, yeah, I mean it's not that bad, maybe I think about it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.