Sample App create with vaadin 8 template doesn’t short

I create in eclipse a Proyect Vaadin 8 using CRUD template, everithing works fine but the Product GRID dosen’t short when you click in column headers,

¿what could be the problem?

Hi,

If I understand correctly, basically: it’s not implemented in the demo backend. In a real application, there would probably be a database, which would make some things pretty straightforward (like ORDER BY queries) that wouldn’t make sense to implement in a mock service. Take a look at the docs about the Vaadin Data Model,
especially the part about sorting
, to get some ideas about what would happen in a real lazy-loading application.

Best regards,
Olli

Hi Oli

thanks for the quick answer, I will try in that way, but beside the shorting in backend data, some times especially for low number of rows, that already are on client, shorting them with out asking shorted data to server, was a interesting feature. I guest that the table component was working in that way shorting his own data , also in sampler demo ( https://demo.vaadin.com/sampler/#ui/grids-and-trees/grid/features) it works the short and I can not see the diference between the code of sampler and the CRUD template that determines the short to work .

Best Regards, César

Hi,

if you’re just using a basic in-memory dataprovider, like the built-in ListDataProvider that you can use with grid.setItems, sorting should work withoug any special tricks as long as the column is sortable too. This might require a Comparator if the column values aren’t naturally comparable (usually when you have a Converter in the mix, like if you’re displaying a list of values in a column). You’ll usually only need to think about sorting if you’ve got lazy/indirect loading of data, like in the CRUD template.

-Olli