Programmtic template macro rendering?

Plone 6 classic

This is perhaps a wild idea so I'll give some background on what I'm trying to do. I'm trying to use datatables for a table with a large number of rows and would like to use the JSON feed to load dynamically. The data requires a lot of HTML in each cell and and I already have a chameleon page template macro for each column cell. What I wanted to try was to call each macro with whatever variables and then stuff this into a JSON feed. I don't know if this is even possible?

I think the alternative would be to not use chameleon templates at all, and build the table entirely in javascript. This is not as attractive to me because I'm using these same template macros on other views and would prefer to have a single method to do so.

Create a browser view that render the template for a row. Then use it to stuff the result in the json file.

1 Like

I think a custom serializer via REST API and a Browser View for each row/cell should resolve your Problem. You can add the HTML Snippet for the Row to your JSON in your own Serializer.

1 Like

This might be related: