0

We are trying to reuse our custom cotrol display templates in several different places. We've found several different tutorials on modifying the item display template, but not much on customizing the control template.

The layout/relationship of the control and item templates is expressed in this image.

What we want to do is change the value of "My Heading." Basically that each time we use the control template it is able to get a title from the title of the cswp. Is this possible?

Otherwise there doesn't seem to be a way to reuse the control template. Am I missing something here? It seems there should be a pretty easy way to work with.

1

Yes you can do that. I haven't done exactly what you'd like to do but found a quick post that lists what seems to be the same thing. You may need to change the selector a bit, but the logic should be the same.

http://geeks.ms/blogs/lmanez/archive/2014/05/14/office-365-selecting-webpart-title-from-display-template.aspx

As far as not being able to reuse a control template, you can do more than just have a dynamic title. It's controlling the layout of how you will view your data. For example, If you want to lay it out in a table that is different than the OOTB layout you would do that through the control template.

  • Thanks. That doesn't seem to work I'm getting an object that doesn't seem to have any values. But I think it points me in a direction that we can use... – Rothrock Feb 3 '15 at 16:29
  • Have you found a solution ? We've got the same requirement... displaying the webpart title inside our control display template.... – Fabian Nov 1 '16 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.