Comments (1)
https://weblaze.dev/pluto_grid/build/web/index.html#feature/value-formatter
Updated to version 0.1.18.
You can check it out at the demo link.
Ignore the comments below.
It seems to be a necessary feature, but it doesn't exist right now.
I'll add it soon (perhaps in a week...).
Thanks for the good question.
Until then, you can handle it like below.
handle each time the value changes in onChanged or
You can handle it when you tap the save button from onLoaded to the stateManager. Or you can handle it by adding an event to the changeNotifier with stateManager.addListener.
If you have more questions, please ask.
I will close this issue when I add a feature.
import 'package:flutter/material.dart';
import 'package:pluto_grid/pluto_grid.dart';
import '../../widget/pluto_example_button.dart';
import '../../widget/pluto_example_screen.dart';
class NumberTypeColumnScreen extends StatefulWidget {
static const routeName = 'feature/number-type-column';
@override
_NumberTypeColumnScreenState createState() => _NumberTypeColumnScreenState();
}
class _NumberTypeColumnScreenState extends State<NumberTypeColumnScreen> {
List<PlutoColumn> columns;
List<PlutoRow> rows;
PlutoStateManager stateManager;
@override
void initState() {
super.initState();
columns = [
PlutoColumn(
title: 'Id',
field: 'id',
type: PlutoColumnType.text(),
),
PlutoColumn(
title: 'Permission',
field: 'permission',
type: PlutoColumnType.select(['Block', 'Use']),
),
];
final rowsFromServer = [
{
'id': 'user1',
'permission': 0,
},
{
'id': 'user2',
'permission': 1,
}
];
rows = rowsFromServer.map((e) {
return PlutoRow(cells: {
'id': PlutoCell(value: e['id']),
'permission': PlutoCell(
value: e['permission'] == 0 ? 'Block' : 'Use',
),
});
});
}
@override
Widget build(BuildContext context) {
return PlutoExampleScreen(
title: 'Number type column',
topTitle: 'Number type column',
topContents: [
Text('A column to enter a number value.'),
],
topButtons: [
PlutoExampleButton(
url:
'https://github.com/bosskmk/pluto_grid/blob/master/example/lib/screen/feature/number_type_column_screen.dart',
),
],
body: Column(
children: [
PlutoGrid(
columns: columns,
rows: rows,
onChanged: (PlutoOnChangedEvent event) {
if (event.column.field == 'permission') {
final changedPermission =
event.row.cells['permission'].value == 'Block' ? 0 : 1;
// update
// permission = changedPermission
// id = event.row.cells['id'].value
}
},
onLoaded: (PlutoOnLoadedEvent event) {
stateManager = event.stateManager;
},
),
FlatButton(
onPressed: () {
final List<Map<String, dynamic>> rowsToUpdate =
stateManager.rows.map((e) {
return {
'id': e.cells['id'].value,
'permission': e.cells['permission'].value == 'Block' ? 0 : 1,
};
});
// update rowsToUpdate
},
child: Text('Save'),
),
],
),
);
}
}
from pluto_grid.
Related Issues (20)
- [Bug] Unexpected null value. rightFrozenLeftOffset HOT 2
- [Bug] Back button not working when Navigating to a Page with PlutoGrid on Android HOT 6
- > Still not resolved
- [Feature] Please add Korean language.
- Row height and styling [Help] HOT 1
- Please add a onEdit() callback to enable checks and formatting during editing HOT 1
- pluto_grid_export is not compatible with Flutter 3.22.2 and Dart 3.4.3 HOT 1
- [Bug] Using arrow keys to move around the Linux grid HOT 1
- how optimize for a huge number of records HOT 1
- 分页按钮颜色是不是不可以调整[Feature] HOT 2
- [Help] open Editing Mode on spec column (All Row ) by one click ! HOT 2
- [Help] Can we create a custom widget in cells instead of standard ones like text, number, date, time, etc? HOT 2
- [Help] how can i make the rows update automatically when a provider value changes HOT 2
- Showing two lines at the end HOT 2
- [Help] How to write text to filter field of the grid? HOT 1
- How can i set fontWeight: FontWeight.bold in PlutoRow => PlutoCell ?[Help] HOT 2
- [Bug] HOT 1
- [Help] HOT 1
- [Help] header or Footer in TextField can't editing on Flutter Web HOT 1
- Onchanged function is not called correctly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pluto_grid.