Hi Robert,
I had a similar requirement in one of my projects. Initially, I also considered using non-persistable entities. However, in my case, the table had more than 15 columns and 10+ rows, which meant creating a large number of objects in the microflow.
To avoid that additional overhead, I thought of generating an HTML string dynamically and rendering it in the UI to create the table structure, as shown below.
The HTML string and the resulting table in the UI would look something like the below:
So, you can also generate the HTML string dynamically based on your requirements and use any HTML rendering widget to display it as a table in the UI.
You're actually very close. The part you're missing is that most of these matrix widgets don't expect you to "pass a list" of NPEs directly to them.
Since you've already created the non-persistable Row, Column, and Cell structure and can populate it from your ElementsOnPage data, the next step is usually to create a single root/context object that the widget can use as its datasource.
A common approach is:
MatrixContext).From your description, it sounds like the data transformation itself is not the problem. The challenge is understanding what object the widget expects as its context and how it navigates the associations. Most matrix widgets work with a hierarchy of objects rather than receiving arbitrary lists directly.
Also, before investing too much effort into reshaping your data model, I'd double-check whether the widget really requires separate Row/Column/Cell entities. Your current model already contains Row, Column, and Value, which is essentially a matrix structure. Depending on the widget, you may be able to build the view with far less transformation than you think.
If you share which specific matrix widget you're using, it will be easier to explain the exact datasource structure it expects.
Hi,
thanks for your input.
I managed to do something like that with a javascript action, so the actual render is not a big issue. My problem is that I need to add a callback to a microflow when someone clicks on a cell. That is the the part I can't manage to do...