Question

Is there a way to list what web part properties the actual display template is using? I want to display what web part zone the display templates are using? This without iheriting the ContentBySearchWebPart, see link below?

pass parameters to the control display template

I want is to have a dynamic display template based on the width / zone of the web part. What I mean with dynamic, is that you get different info / layout / branding based on what zone the display template is in. I'm using responsive design and I don't want to calculate the width using javascript (calculating the parent div.. )

How can I get the property in yellow, see image below: example image

Was it helpful?

Solution

One solution found link below:

sharepoint-2013-display-templates-media-queries-to-get-image-rendition-on

<!--#_
AddPostRenderCallback(ctx, function()
{    
     var width = $(window).width();
     var rendition = '?RenditionID=2'; 
     if(width <= 320){
         rendition = '?RenditionID=1';
     }
     jQuery('.image-to-fix').each(function(){
           jQuery(this).css('background-image', jQuery(this).attr('data-image') + rendition);
     });
});
_#-->
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top