Grid / TreeGrind get and manipulate data best way

Hi,

i have a Treegrid like

 private TreeGrid<Item> treeGrid = new TreeGrid<>();
    private TreeData<Item> data = new TreeData<>();
    TreeDataProvider<Item> dataProvider = new TreeDataProvider<>(data);

once the data are loaded and displayed i have some inputfield, slider etc wich has influence to the shown data. For example when i slide a slider, the prices in the grid needs to be changed.

Which would be the best way to change the data in the best way? Currently i am iterating over the items in the grid and setting them the new value. Is that the correct way or do i need to manipulate the dataprovider data?

Without any further details regarding your application architecture, its usage / scope or sample code, I would say, yes, it sounds like the correct way, when you want to work with in memory data. The in memory data provider uses your objects as a base, so manipulating these and then calling a refreshItem/refreshAll on the data provider should work.

Disadvantage of that approach is of course the scalability: using an in memory data provider has always the downside, that it may hit your server, when the data or the parallel users grow.

ok thanks. what would will be your suggestion? Saving the data in a database, manipulating it and refresh it?

We talk about a product table with less then 50 “products” and 5 columns. So not that huge thing

With that kind of dataset, in-memory is easily the most optimal solution.

2 Likes