Atozed Forums
TIWTemplateProcessor - at runtime - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: TIWTemplateProcessor - at runtime (/thread-3876.html)



TIWTemplateProcessor - at runtime - lfeliz - 02-10-2024

I have a situation where I would like to use  TIWTemplateProcessor in a region, but be able to change the template applied based on a runtime condition (order type) set when user sets a value or in an onscroll event. 

In the past, before I got wise to templates, I would stack the regions and just show the one I wanted, but with templates, I can just expose the controls needed based on the type of order

What is best way to force the region to repaint using the updated template?


Thanks
- Lou


RE: TIWTemplateProcessor - at runtime - swiatex - 02-12-2024

I'm doing


Code:
IWTemplateProcessorHTML1.MasterTemplate := 'IWFormBase.html';
AsyncReload(true);


However, I believe there must be a better solution. This, of course affect whole page, not the region.


RE: TIWTemplateProcessor - at runtime - RenSword - 02-15-2024

Code:
  IWTemplateProcessorHTML2.Templates.Default := 'change.html';
  AsyncRenderComponent(IWRegion1);
u can try AsyncRenderComponent (Usable at TIWAppForm level), but I am unsure if it is safe to use.


RE: TIWTemplateProcessor - at runtime - Alexandre Machado - 02-19-2024

We are about to release an update (15.5.7) that will allow you to do what you want in this case.

You will just need to call:


Code:
  IWTemplateProcessorHTML2.Templates.Default := 'change.html';
  IWRegion1.RefreshAsyncRender;

Stay tuned!


RE: TIWTemplateProcessor - at runtime - Alexandre Machado - 02-22-2024

Hi Lou,

please update to the latest IW 15.5.7 and use the code that I mentioned above. It will "just work"

Kind regards,