Make PlutoColumnType extendable to allow for custom column types
My immediate inclination was to create my own custom column types, for example uuid, bool, or multi-select. However, the way that the column type is implemented doesn't seem to be extendable.
I agree with @cthurston. I will like to customize my column to any widget, like an image. Not just "Text, number, date ......".
@afesohromeo I also agree that it is necessary to add other types to PlutoGrid other than text, number, date, etc.
For widgets such as images, you can add a text type column to set the value as an image address and have the renderer output an image instead of text.
I would appreciate it if you could tell me a little more about the situation in which an additional part is needed in the above situation.
Another example is select columns. If you have an usual pair of key + corresponding labels, it could be great to have something more versatile for this scenarios, like:
/// Provides a selection list and sets it as a selection column.
factory PlutoColumnType.select(
Map<dynamic, String>? items, { // 👈🏻 Change List<dynamic> to this Map to allow to use any type
dynamic defaultValue = '',
bool enableColumnFilter = false,
}) {
...
My actual need is to have an autocomplete column (values loaded from remote serveur with search filter)
The PlutoColumnTypeSelect has a "static list" and is not very usefull for editing "fast" in the grid
I think i will create a custom column type, with a specific renderer ( rendering a text if not editing, and an autocomplete if cell is currently in edit mode ) But i don't known if i can trigger the onChanged of the grid...
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Do we have any plans for support this?
Any update on this?
@afesohromeo I also agree that it is necessary to add other types to PlutoGrid other than text, number, date, etc. For widgets such as images, you can add a text type column to set the value as an image address and have the renderer output an image instead of text. I would appreciate it if you could tell me a little more about the situation in which an additional part is needed in the above situation.
how to do it? I cannot find any documentation to render image in cell
Add this code : renderer: (rendererContext) { final String imageURL = rendererContext.cell.value as String; return Image.network(imageURL); },
what about this? is there an option to show key+description?
Another example is
selectcolumns. If you have an usual pair of key + corresponding labels, it could be great to have something more versatile for this scenarios, like:/// Provides a selection list and sets it as a selection column. factory PlutoColumnType.select( Map<dynamic, String>? items, { // 👈🏻 Change List<dynamic> to this Map to allow to use any type dynamic defaultValue = '', bool enableColumnFilter = false, }) { ...
did you found some solution for this?
Here's a sketch.
class PlutoColumnDynamic implements PlutoColumnType {
@override
int compare(a, b) => 0;
@override
bool isValid(value) => true;
@override
makeCompareValue(v) {}
@override
dynamic defaultValue;
}
PlutoColumn test() => PlutoColumn(
title: 'test',
field: 'test',
renderer: (rendererContext) => rendererContext.cell.value as Widget,
type: PlutoColumnDynamic(),
);
PlutoRow(
cells: {
'test': PlutoCell(value: Text('test2')),
},
),
Unfortunately, there remains the problem of automatic height adjustment for PlutoRow, but I will try to solve this in another question (when it works, I will attach a link).