Developer forum

Forum » CMS - Standard features » Is it possible to use RenderRowContent ?

Is it possible to use RenderRowContent ?

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I am trying to augment some product pages with content defined using Visual Editor.

And I am wondering if it would be possible to use something similar to RenderParagraphContent({ParagraphID}) but for Rows in this case. Of course, this means the output should be the combination of row, columns and associated templates.

Is it possible? Any other suggestions in order to accomplish my objective?

Thank you,

Adrian


Replies

 
Nicolai Pedersen
Reply

You cannot with rows. They depend on their row definition that is setup on a layout.

But you can render the grid (all rows) from one page on another using @RenderGrid in your viewmodel templates, i.e. a layout template using pageviewmodel or a productListViewModel template from the product catalog from viewmodels app.

RenderGrid takes a pageid as an argument - so you need a page for each piece of content - one or more rows.

Be careful of performance. Cannot guarentee anything if you call this many times on a page.

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

That's even better.

That's how I was planning it. One page per request.

What if I have a Page using VisualEditor and one of the columns will have a ProductCatalog in it and I am planning on inserting this Row into the ProductsRender.cshtml template?

This will be inserted only in top-level category pages, I expect it to be cached but we'll see how it will handle it.

I can also try and load it async if performance will be an issue.

Thank you,

Adrian

 
Nicolai Pedersen
Reply

You should be able to do that. Try it!

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

I have tried using RenderGrig(<pageId>) but it only works on the ContentPage template.

As you mentioned, ViewModel templates only.

I am not using the productListViewModel template yet for my ProductList and therefore I cannot use this approach in ProductRender or in product list blocks.

I cannot use it in ContentPage either because I don't have access to Group properties there.

Apart from the option of switching to productListViewModels, what other option do I have if I want to enrich the ProductList page with VisualEditor managed content?

Thank you,

Adrian

 
Nicolai Pedersen
Reply

Custom code...

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

That's obviously gonna be custom code. I have no doubt about it.

But I can be done in a couple of ways and I was wondering which approach would be the most efficient one.

To put it simply, how would you do it?

Thank you,


Adrian

 

You must be logged in to post in the forum