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)
- PlutoColumnType.select don't update value in release mode HOT 1
- [Bug] F5 Key ist not working in browser HOT 1
- [Bug] HOT 3
- [Bug] Use PlutoGridStateManager to select one row is not working when mode is select or selectWithOneTap HOT 1
- [Help] How to disable cell selection when select mode is setted. HOT 2
- How can I change the text color of ColumnGroup header? HOT 2
- [Bug] ++ pubspec.yaml for pluto_grid_export HOT 3
- [Help] How to create a custom filter for Dates using a datePicker? HOT 2
- [Feature] Custom sorting on column based on value HOT 2
- [Help] - How to detect cell value change without "exiting" the cell HOT 2
- [Help] How to customize the keyboard buttons for numbers value in android HOT 1
- [Help] Copy the content of selecting cell to the clipboard HOT 2
- [Bug] HOT 1
- [Help] Why PlutoDualGridProps onSelected Callback? HOT 1
- TextField Focus issue HOT 1
- [Help] How to disable (showFilterPopup)?[Help]
- Show some empty space on the top of first row only in mobile phone HOT 2
- How to move to the next cell automatically when press done button from the android keyboard?
- [Feature] Checkbox Column does not respect checkboxTheme of ThemeData
- [Issue] date format
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.