Date column in Grid - Flow

I am trying to add a Date column to a Grid. Where can I find an example which would work with the “Trippy” Flow example?

TIA,
Carl

I did this:

    grid.addColumn("My Date", (Property source) -> {
        LocalDateTime dateTime = LocalDateTime.ofInstant(source.getMyDate().toInstant(), ZoneId.systemDefault());
        return dateTime.format(DateTimeFormatter.ISO_LOCAL_DATE);
    });

Hi. Which sample is the “Trippy” Flow sample? Did your solution work or do you still need help?

Hi, Carl.

That’s the example, I guess: https://github.com/vaadin/trippy/

You’re doing almost everything correct.
The only thing that needs to be adjusted is

[b] (Property source) -> [/b]

It should be [b] (Trip source) -> [/b] or just [b] source -> [/b]
This is required due to Grid declaration: the example have specified [b] Trip [/b] as a Grid generic type: [b] private Grid<Trip> grid = new Grid<>(); [/b] which means that the Grid expects the data provided from this type of objects.

So, for your case, you should either use the other object in Grid declaration or add an extra field to the object and use it in when adding the new column.

Thank you Kirill

Thank you Johannes. It worked but it was nice to see a bit more about it.

So, you’ve done everything correct then, even better.

I’m afraid that now I don’t understand what can I help you with, looks like it should be working.
Is there a compilation failure? Any runtime issue?

Awesome, thanks a lot!

Be sure to check the next release when it’s out, we’ll be adding more Grid stuff there.

Ah, sorry for the confusion…I should have said that I answered my own question and I guess marked it as such.

Nice to see the activitiy here however. I am very happy to see Flow and looking forward to a release.

Great work!!