简体   繁体   中英

how to find muliple rows which has one column value same and add to one row and set to vaadin grid

I am new to vaadin and java. I have one class has two values like name and adress. I have list like below

john 101 doe 102 john 204 pri 403 doe 103 john 206

first column is name and second column is address.Now I want filter list like below

john 101 204 206 doe 102 103 pri 403

is it possible to filter? please help me out!

How it is done depends a bit on which version of Vaadin you are using, but concept wise they are the same.

You can use either of these:

1. Sorting

By sorting the grid by columns [[“name”, asc],[“adress”,arc]] you should get it. That is sorting by two columns, first name then adress. Output should look like this

John 101
John 204
John 206
Doe  102
Doe  103
Pri  403

2. TreeGrid

If you instead want to group the rows you can replace Grid with TreeGrid and put all with John as children of a main object. Then you still want to sort after that I would say. End result looks like this (and arrows can be opened or closed):

> John
        101
        204
        206
> Doe
        102
        103
> Pri
        403

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM