What would be the best practice for the following scenario:
There´s a grid that will be filled and must be changed according to each row. For instance, there´s a grid filled with products, then according to each product one of the columns will be dynamically populated. Is it better to return from the service all the productdetail table and query it on the client side or have a method on the service that will return only the data needed? The latter would mean that if there are n number of products on the grid, there will be n requests to that service method.
My dilemma is that for some of the users the table will be relatively small and sending it to the client might not be a big deal, but other users do have a considerable amount of rows that would be returned (more than 15k).
Thanks for any insight you may bring.
I’d suggest creating some sort of ViewModel on the server to tailor the data for the client. This is similar to your second option; however, it’s not done on row by row. It’s a batch operation on the server side which preps the columns so the view doesn’t need any special logic.
I feel manipulating data on the client side can be tricky because there’s so many variables- browser, os, computing power. You control the server, so leverage what you control as much as possible.
Good luck.