Skip to content

This demo shows how to copy multiple cell values in Flutter DataTable?.

Notifications You must be signed in to change notification settings

SyncfusionExamples/How-to-copy-multiple-cell-values-in-Flutter-DataTable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to copy multiple cell values in Flutter DataTable (SfDataGrid)?.

In this article, we will show you how to copy multiple cell values in Flutter DataTable.

Initialize the SfDataGrid with the necessary properties. By using SelectionArea, you can copy multiple cell values. Setting SelectionArea as the parent of SfDataGrid allows you to copy the entire cell content to the clipboard by dragging. To achieve this, enable SfDataGrid.shrinkWrapRows to prevent row reuse during scrolling. However, keep in mind that enabling shrinkWrapRows constructs all rows during the initial load.

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Syncfusion Flutter DataGrid'),
      ),
      body: SelectionArea(
        child: SfDataGrid(
          source: employeeDataSource,
          shrinkWrapRows: true,
          columnWidthMode: ColumnWidthMode.fill,
          columns: <GridColumn>[
            GridColumn(
                columnName: 'id',
                label: Container(
                    padding: const EdgeInsets.all(16.0),
                    alignment: Alignment.center,
                    child: const Text(
                      'ID',
                    ))),
            GridColumn(
                columnName: 'name',
                label: Container(
                    padding: const EdgeInsets.all(8.0),
                    alignment: Alignment.center,
                    child: const Text('Name'))),
            GridColumn(
                columnName: 'designation',
                label: Container(
                    padding: const EdgeInsets.all(8.0),
                    alignment: Alignment.center,
                    child: const Text(
                      'Designation',
                      overflow: TextOverflow.ellipsis,
                    ))),
            GridColumn(
                columnName: 'salary',
                label: Container(
                    padding: const EdgeInsets.all(8.0),
                    alignment: Alignment.center,
                    child: const Text('Salary'))),
          ],
        ),
      ),
    );
  }

You can download this example on GitHub.

About

This demo shows how to copy multiple cell values in Flutter DataTable?.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •