Skip to content

Commit 336720d

Browse files
FLUT-927696-[others]: update data grid file
1 parent 5a9e355 commit 336720d

File tree

14 files changed

+570
-7
lines changed

14 files changed

+570
-7
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Syncfusion License
2+
3+
Syncfusion Flutter DataGrid package is available under the Syncfusion Essential Studio program, and can be licensed either under the Syncfusion Community License Program or the Syncfusion commercial license.
4+
5+
To be qualified for the Syncfusion Community License Program you must have a gross revenue of less than one (1) million U.S. dollars ($1,000,000.00 USD) per year and have less than five (5) developers in your organization, and agree to be bound by Syncfusion’s terms and conditions.
6+
7+
Customers who do not qualify for the community license can contact [email protected] for commercial licensing options.
8+
9+
Under no circumstances can you use this product without (1) either a Community License or a commercial license and (2) without agreeing and abiding by Syncfusion’s license containing all terms and conditions.
10+
11+
The Syncfusion license that contains the terms and conditions can be found at
12+
https://www.syncfusion.com/content/downloads/syncfusion_license.pdf
Lines changed: 294 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
![syncfusion flutter datagrid](https://cdn.syncfusion.com/content/images/Flutter/pub_images/Flutter-DataGrid.png)
2+
3+
# Flutter DataGrid (DataTable) library
4+
5+
The Flutter DataTable or DataGrid is used to display and manipulate data in a tabular view. It is built from the ground up to achieve the best possible performance, even when loading large amounts data.
6+
7+
**Disclaimer:** This is a commercial package. To use this package, you need to have either a Syncfusion commercial license or [Free Syncfusion Community license](https://www.syncfusion.com/products/communitylicense). For more details, please check the [LICENSE](https://github.com/syncfusion/flutter-examples/blob/master/LICENSE) file.
8+
9+
## Table of contents
10+
- [DataGrid features](#datagrid-features)
11+
- [Get the demo application](#get-the-demo-application)
12+
- [Useful links](#other-useful-links)
13+
- [Installation](#installation)
14+
- [Getting started](#getting-started)
15+
- [Creating data for an application](#creating-data-for-an-application)
16+
- [Creating data source for DataGrid](#creating-datasource-for-datagrid)
17+
- [Defining columns](#defining-columns)
18+
- [Support and feedback](#support-and-feedback)
19+
- [About Syncfusion](#about-syncfusion)
20+
21+
## DataGrid features
22+
23+
**Column types** - Support to load any widget in a each column.
24+
25+
![Flutter DataGrid shows different column types](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-column-types.png)
26+
27+
**Editing** - Allows users to edit cell values. An editor widget can be loaded based on the column type to edit cell values.
28+
29+
![Editing in Flutter DataGrid](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-editing.png)
30+
31+
**Column sizing** - Set the width of columns with various sizing options. Fit the columns based on the value of the cells to improve readability.
32+
33+
**Row height** - Set the height for header and data rows. Fit the rows based on the value of the cells to improve readability. Also, set the different height for specific rows.
34+
35+
![Flutter DataGrid shows rows in auto-fit](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-auto-row-height.png)
36+
37+
**Sorting** - Sort one or more columns in the ascending or descending order.
38+
39+
![Columns are sorted in flutter datagrid](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-sorting.gif)
40+
41+
**Selection** - Select one or more rows. Keyboard navigation is supported for web platforms. Built-in checkbox columns allow display of a checkbox in each row to select entire rows when the boxes are checked. Users can also select or deselect all the rows by selecting the checkbox in the header.
42+
43+
![Flutter DataGrid shows rows with selection](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-selection.png)
44+
45+
**Styling** - Customize the appearance of cells and headers. Conditional styling is also supported.
46+
47+
![Styling in Flutter DataGrid](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-styling.png)
48+
![Styling in Flutter DataGrid](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-conditional-styles.png)
49+
50+
**Stacked headers** - Show unbound header rows. Unbound header rows span stacked header columns across multiple rows and columns.
51+
52+
![Flutter datagrid shows multiple column headers](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-stacked-headers.png)
53+
54+
**Summary row** - Show an additional unbound row to display a summary or totals. Users can display a minimum, maximum, average, and count in columns.
55+
56+
![Flutter datagrid shows table summary rows](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-table-summary-row.png)
57+
58+
**Column resizing** - Resize the columns by tapping and dragging the right border of the column header.
59+
60+
![Column resizing in Flutter datagrid](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-column-resizing.gif)
61+
62+
**Load more** - Display an interactive view when the grid reaches its maximum offset while scrolling down.
63+
64+
![infinite scrolling in Flutter datagrid](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-load-more.gif)
65+
66+
**Paging** - Load data in segments. It is useful when loading huge amounts of data.
67+
68+
![Flutter DataGrid shows rows in page segments](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-paging.png)
69+
70+
**Footer** - Show an additional row that can be displayed below to last row. Widgets can also be displayed in the footer row.
71+
72+
![Footer view in Flutter DataGrid](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-footer-view.png)
73+
74+
**Freeze Panes** - Freeze the rows and columns when scrolling the grid.
75+
76+
![First row and column are frozen in flutter datagrid](https://cdn.syncfusion.com/content/images/Flutter/pub_images/flutter-datagrid-freeze-panes.gif)
77+
78+
**Grouping** - Allows users to organize and categorize data based on specific criteria, facilitating efficient interaction with summarized information.
79+
80+
**Column drag and drop** - Interactively customize the arrangement of columns by dragging and dropping them, enhancing user flexibility and personalization in organizing and viewing data.
81+
82+
**Swiping** - Swipe a row right to left or left to right for custom actions such as deleting, editing, and so on. When the user swipes a row, the row will be moved and the swipe view will show the custom actions.
83+
84+
**Pull to refresh** - Allows users to refresh data when the DataGrid is pulled down.
85+
86+
**Exporting** - Export the DataGrid content, such as rows, stacked header rows, and table summary rows, to Excel and PDF format with several customization options.
87+
88+
**Theme** - Use a dark or light theme.
89+
90+
**Accessibility** - The DataGrid can easily be accessed by screen readers.
91+
92+
**Right to Left (RTL)** - Right-to-left direction support for users working in RTL languages like Hebrew and Arabic.
93+
94+
## Get the demo application
95+
96+
Explore the full capabilities of our Flutter widgets on your device by installing our sample browser applications from the following app stores, and view sample code in GitHub.
97+
98+
<p align="center">
99+
<a href="https://play.google.com/store/apps/details?id=com.syncfusion.flutter.examples"><img src="https://cdn.syncfusion.com/content/images/FTControl/google-play-store.png"/></a>
100+
<a href="https://flutter.syncfusion.com"><img src="https://cdn.syncfusion.com/content/images/FTControl/web-sample-browser.png"/></a>
101+
<a href="https://www.microsoft.com/en-us/p/syncfusion-flutter-gallery/9nhnbwcsf85d?activetab=pivot:overviewtab"><img src="https://cdn.syncfusion.com/content/images/FTControl/windows-store.png"/></a>
102+
</p>
103+
<p align="center">
104+
<a href="https://install.appcenter.ms/orgs/syncfusion-demos/apps/syncfusion-flutter-gallery/distribution_groups/release"><img src="https://cdn.syncfusion.com/content/images/FTControl/macos-app-center.png"/></a>
105+
<a href="https://snapcraft.io/syncfusion-flutter-gallery"><img src="https://cdn.syncfusion.com/content/images/FTControl/snap-store.png"/></a>
106+
<a href="https://github.com/syncfusion/flutter-examples"><img src="https://cdn.syncfusion.com/content/images/FTControl/github-samples.png"/></a>
107+
</p>
108+
109+
## Other useful links
110+
Check out the following resource to learn more about the Syncfusion Flutter DataGrid:
111+
112+
* [Syncfusion Flutter DataGrid product page](https://www.syncfusion.com/flutter-widgets/flutter-datagrid)
113+
* [User guide documentation](https://help.syncfusion.com/flutter/datagrid/overview)
114+
115+
## Installation
116+
117+
Install the latest version from [pub](https://pub.dartlang.org/packages/syncfusion_flutter_datagrid#-installing-tab-).
118+
119+
## Getting started
120+
121+
Import the following package.
122+
123+
```dart
124+
import 'package:syncfusion_flutter_datagrid/datagrid.dart';
125+
```
126+
### Creating Data for an application
127+
128+
The SfDataGrid is dependent upon data. Create a simple data source for `SfDataGrid` as shown in the following code example.
129+
130+
```dart
131+
class Employee {
132+
Employee(this.id, this.name, this.designation, this.salary);
133+
final int id;
134+
final String name;
135+
final String designation;
136+
final int salary;
137+
}
138+
```
139+
140+
Create the collection of employee data with the required number of data objects. Here, the method used to populate the data objects is initialized in initState()
141+
142+
`DataGridSource` objects are expected to be long-lived, not re-created with each build.
143+
144+
```dart
145+
List<Employee> employees = <Employee>[];
146+
147+
late EmployeeDataSource employeeDataSource;
148+
149+
@override
150+
void initState() {
151+
super.initState();
152+
employees= getEmployees();
153+
employeeDataSource = EmployeeDataSource(employees: employees);
154+
}
155+
156+
List<Employee> getEmployees() {
157+
return[
158+
Employee(10001, 'James', 'Project Lead', 20000),
159+
Employee(10002, 'Kathryn', 'Manager', 30000),
160+
Employee(10003, 'Lara', 'Developer', 15000),
161+
Employee(10004, 'Michael', 'Designer', 15000),
162+
Employee(10005, 'Martin', 'Developer', 15000),
163+
Employee(10006, 'Newberry', 'Developer', 15000),
164+
Employee(10007, 'Balnc', 'Developer', 15000),
165+
Employee(10008, 'Perry', 'Developer', 15000),
166+
Employee(10009, 'Gable', 'Developer', 15000),
167+
Employee(10010, 'Grimes', 'Developer', 15000)
168+
];
169+
}
170+
```
171+
172+
### Creating DataSource for DataGrid
173+
174+
`DataGridSource` is used to obtain the row data for the `SfDataGrid`. So, create the data source from the DataGridSource and override the following APIs in it:
175+
176+
* `rows`: Fetches the rows available for data population. Also, it is used to fetch the corresponding data object to process the selection. This contains the collection of `DataGridRow` where each row contains the collection of `DataGridCell`. Each cell should have the cell value in `value` property. `value` is used to perform the sorting for columns.
177+
178+
* `buildRow`: Fetches the widget for each cell with `DataGridRowAdapter`.
179+
180+
```dart
181+
class EmployeeDataSource extends DataGridSource {
182+
EmployeeDataSource({List<Employee> employees}) {
183+
_employees = employees
184+
.map<DataGridRow>((e) => DataGridRow(cells: [
185+
DataGridCell<int>(columnName: 'id', value: e.id),
186+
DataGridCell<String>(columnName: 'name', value: e.name),
187+
DataGridCell<String>(
188+
columnName: 'designation', value: e.designation),
189+
DataGridCell<int>(columnName: 'salary', value: e.salary),
190+
]))
191+
.toList();
192+
}
193+
194+
List<DataGridRow> _employees = [];
195+
196+
@override
197+
List<DataGridRow> get rows => _employees;
198+
199+
@override
200+
DataGridRowAdapter? buildRow(DataGridRow row) {
201+
return DataGridRowAdapter(
202+
cells: row.getCells().map<Widget>((dataGridCell) {
203+
return Container(
204+
alignment: (dataGridCell.columnName == 'id' || dataGridCell.columnName == 'salary')
205+
? Alignment.centerRight
206+
: Alignment.centerLeft,
207+
padding: EdgeInsets.all(16.0),
208+
child: Text(dataGridCell.value.toString()),
209+
);
210+
}).toList());
211+
}
212+
}
213+
```
214+
215+
Create an instance of `DataGridSource` and set this object to the `source` property of `SfDataGrid`.
216+
217+
```dart
218+
@override
219+
Widget build(BuildContext context) {
220+
return Scaffold(
221+
appBar: AppBar(
222+
title: Text('Syncfusion DataGrid'),
223+
),
224+
body: Center(
225+
child: Expanded(
226+
child: SfDataGrid(
227+
source: _employeeDataSource,
228+
),
229+
),
230+
));
231+
}
232+
```
233+
234+
### Defining columns
235+
236+
`SfDataGrid` supports load any widget in columns. You can add the column collection to the `columns` property.
237+
238+
```dart
239+
@override
240+
Widget build(BuildContext context) {
241+
return Scaffold(
242+
appBar: AppBar(
243+
title: const Text('Syncfusion Flutter DataGrid'),
244+
),
245+
body: SfDataGrid(
246+
source: employeeDataSource,
247+
columns: <GridColumn>[
248+
GridColumn(
249+
columnName: 'id',
250+
label: Container(
251+
padding: EdgeInsets.all(16.0),
252+
alignment: Alignment.centerRight,
253+
child: Text(
254+
'ID',
255+
))),
256+
GridColumn(
257+
columnName: 'name',
258+
label: Container(
259+
padding: EdgeInsets.all(16.0),
260+
alignment: Alignment.centerLeft,
261+
child: Text('Name'))),
262+
GridColumn(
263+
columnName: 'designation',
264+
width: 120,
265+
label: Container(
266+
padding: EdgeInsets.all(16.0),
267+
alignment: Alignment.centerLeft,
268+
child: Text('Designation'))),
269+
GridColumn(
270+
columnName: 'salary',
271+
label: Container(
272+
padding: EdgeInsets.all(16.0),
273+
alignment: Alignment.centerRight,
274+
child: Text('Salary'))),
275+
],
276+
),
277+
);
278+
}
279+
```
280+
281+
The following screenshot illustrates the result of the above code sample.
282+
283+
![syncfusion flutter datagrid](https://cdn.syncfusion.com/content/images/Flutter/pub_images/getting-started-flutter-datagrid.png)
284+
285+
## Support and Feedback
286+
287+
* If you have any questions, you can reach the [Syncfusion support team](https://support.syncfusion.com/support/tickets/create) or post queries to the [community forums](https://www.syncfusion.com/forums). You can also submit a feature request or a bug report through our [feedback portal](https://www.syncfusion.com/feedback/flutter).
288+
* To renew your subscription, click [renew](https://www.syncfusion.com/sales/products) or contact our sales team at [email protected] | Toll Free: 1-888-9 DOTNET.
289+
290+
## About Syncfusion
291+
292+
Founded in 2001 and headquartered in Research Triangle Park, N.C., Syncfusion has more than 20,000 customers and more than 1 million users, including large financial institutions, Fortune 500 companies, and global IT consultancies.
293+
294+
Today we provide 1,600+ controls and frameworks for web ([ASP.NET Core](https://www.syncfusion.com/aspnet-core-ui-controls), [ASP.NET MVC](https://www.syncfusion.com/aspnet-mvc-ui-controls), [ASP.NET WebForms](https://www.syncfusion.com/jquery/aspnet-web-forms-ui-controls), [JavaScript](https://www.syncfusion.com/javascript-ui-controls), [Angular](https://www.syncfusion.com/angular-ui-components), [React](https://www.syncfusion.com/react-ui-components), [Vue](https://www.syncfusion.com/vue-ui-components), [Flutter](https://www.syncfusion.com/flutter-widgets), and [Blazor](https://www.syncfusion.com/blazor-components)), mobile ([.NET MAUI](https://www.syncfusion.com/maui-controls?utm_source=pubdev&utm_medium=listing&utm_campaign=flutter-charts-pubdev), [Xamarin](https://www.syncfusion.com/xamarin-ui-controls), [Flutter](https://www.syncfusion.com/flutter-widgets), [UWP](https://www.syncfusion.com/uwp-ui-controls), and [JavaScript](https://www.syncfusion.com/javascript-ui-controls)), and desktop development ([Flutter](https://www.syncfusion.com/flutter-widgets), [.NET MAUI](https://www.syncfusion.com/maui-controls?utm_source=pubdev&utm_medium=listing&utm_campaign=flutter-charts-pubdev), [WinForms](https://www.syncfusion.com/winforms-ui-controls), [WPF](https://www.syncfusion.com/wpf-ui-controls), [UWP](https://www.syncfusion.com/uwp-ui-controls), and [WinUI](https://www.syncfusion.com/winui-controls)). We provide ready-to- deploy enterprise software for dashboards, reports, data integration, and big data processing. Many customers have saved millions in licensing fees by deploying our software.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# datagrid_example
2+
3+
This example shows how to get started with the Flutter DataGrid.
4+
5+
For more information, refer the below links,
6+
* [User guide documentation](https://help.syncfusion.com/flutter/datagrid/getting-started)
7+
* [Syncfusion Flutter DataGrid product page](https://www.syncfusion.com/flutter-widgets/flutter-datagrid)
Loading
Loading

packages/syncfusion_flutter_datagrid/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ dependencies:
1313
syncfusion_flutter_core:
1414
path: ../syncfusion_flutter_core
1515

16-
17-
1816
collection: ">=1.9.0 <=2.0.0"
1917

20-
18+
dev_dependencies:
19+
flutter_test:
20+
sdk: flutter
2121

2222
flutter:
2323
fonts:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Syncfusion License
2+
3+
Syncfusion Flutter DataGrid Export package is available under the Syncfusion Essential Studio program, and can be licensed either under the Syncfusion Community License Program or the Syncfusion commercial license.
4+
5+
To be qualified for the Syncfusion Community License Program you must have a gross revenue of less than one (1) million U.S. dollars ($1,000,000.00 USD) per year and have less than five (5) developers in your organization, and agree to be bound by Syncfusion’s terms and conditions.
6+
7+
Customers who do not qualify for the community license can contact [email protected] for commercial licensing options.
8+
9+
Under no circumstances can you use this product without (1) either a Community License or a commercial license and (2) without agreeing and abiding by Syncfusion’s license containing all terms and conditions.
10+
11+
The Syncfusion license that contains the terms and conditions can be found at
12+
https://www.syncfusion.com/content/downloads/syncfusion_license.pdf

0 commit comments

Comments
 (0)