Render nested object

Render nested object

van9petrykvan9petryk Posts: 7Questions: 3Answers: 0

From REST API I receive an array of plain objects, like this.
[
{
id_customer: 10,
id_product: 12,
},
...]

So, I need to pre-requests all customer and all products to show some human-readable data. I convert codes to description in render function, but I can also do conversion inside dataSrc, and maybe there is some other way to do it.

In my case, my object is more complex (around 30 fields) and I need to make 10-15 queries to decode values.
But I use responsive, and only 5-8 fields are visible and I am thinking if can I defer requests for getting other objects array, needed to decode main object.
Initially, I make 3-4 requests to have data needed to decode visible fields, and when click on responsive icon to open details, other requests starts.

Maybe the better way is to return all data needed for visualization to avoid extra quesries, but I cannot trasform backend at the moment.

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Unfortunately, there isn't a way to defer the rendering of hidden columns at this time I'm afraid. Here is a quick test case showing that the display renderer is called regardless of column visibility. That is happening because the cell is still created when the row is - we don't have an internal mechanism for delaying that creation yet. Its a nice idea for future development, but I'm afraid that probably isn't a near term feature.

    Allan

Sign In or Register to comment.