11

You need to turn on Publishing Features on your site for the HTML pages to show up, from there you can edit the HMTL files and create new display templates. And yes, this is documented no where.


9

Use this function from msdn //Get the list item from the Announcements list whose Id is 4. Note that this is the ID of the item in the list, not a reference to its position in the collection. var itemId = 4; var targetListItem; function runCode() { var clientContext = new SP.ClientContext(); var targetList = clientContext.get_web()....


8

You should inherit ContentBySearchWebPart, and overload the OnLoad event: protected override void OnLoad(EventArgs e) { if (this.AppManager != null) { if (this.AppManager.QueryGroups.ContainsKey(this.QueryGroupName) && this.AppManager.QueryGroups[this.QueryGroupName].DataProvider != null) { this....


6

Sure you can. It's JS code after all and you could either use a global variable to store your information or the provided ctx object. Here' a example for both possibilities: ControlTemplate: <!--#_ window.ThisIsGlobal = "this works !"; ctx.MyVar = "THIS WORKS !"; _#--> ItemTemplate: <!--#_ alert(window.ThisIsGlobal);...


6

You can use following code in the display template <div title="_#= $htmlEncode(line4.defaultValueRenderer(line4)) =#_" id="_#= line4Id =#_"> _#=STSHtmlDecode(line4.value)=#_ </div> Source - https://ingessharepointnotes.wordpress.com/2014/03/04/sharepoint-display-templates-display-enhanced-rich-text-field/ Another example var desc = $...


6

After banging my head around for some days, the problem was solved by flushing the blob cache. This is the command I used on the Front end server $webApp = Get-SPWebApplication "<WebApplicationURL>" [Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp) Write-Host "Flushed the BLOB cache for:" $webApp https://technet.microsoft....


6

In SharePoint Online the best way to achieve opening of documents in the browser is by appending web=1 as a query string parameter to the file URL like https://tenant.sharepoint.com/Documents/file.docx?web=1. Now, for office documents, like Word, Excel, PowerPoint, etc the serverRedirectedEmbedURL property is populated however for other document types like ...


5

How about something like this: <script type="text/javascript"> _spBodyOnLoadFunctions.push(function(){ ExecuteOrDelayUntilScriptLoaded(showStatusAlert, "sp.js"); }) function showStatusAlert(){ var ctx = SP.ClientContext.get_current(); var web = ctx.get_web(); var list = web.get_lists().getById(_spPageContextInfo.pageListId); var ...


5

In the display template make the following change: var listItemID = ctx.CurrentItem.ListItemID; //change as per your ID var blogUrl = "/sites/Pages/BlogDetail.aspx?ID="; var viewBlogUrl = blogUrl + listItemID; HTML would be as below: <a href="_#= viewBlogUrl =#_" target="_blank">Blog Title</a>


5

Your approach is valid. Creating duplicate managed properties : 1) does not affect performance, it does not slow down search 2) it will not result in duplicate search results. There is no harm or drawback in creating duplicate managed properties. However, what you are facing is a quite common scenario. You need not create duplicate managed properties ...


4

Since it is CSS attributes, the server will not send any of the pictures until the browser parses the CSS and request one of the images based on how it interprets the CSS. Too me, I do not see why this shouldn't work. Just give it a try and then use fiddler or similar to se which requests and responses are sent between the browser and the server. To ...


4

The managed property 'Path' contains the link to the item. Make sure you encode it properly. var encodedPath = $urlHtmlEncode(ctx.CurrentItem.Path);


4

Body render is defined in another display template, look for "Item_CommonItem_Body.html"


4

this is a permissions issue, admin have full access and hence why disabling limited access user permission lockdown mode it works for the images. css/JS issue You need to see within your masterpage/DT where the css are being referenced from? are they on 15hive? if they are than the files/folder needs have the correct security settings applied for wss_wpg ...


4

You are registering on load event. Instead modify as follows AddPostRenderCallback(ctx, function () { alert(jQuery('.ms-srch-hover-subTitle').text()); }) Also take a look at this Run any other javascript after the Display Templates have rendered the content


4

The control templates and display templates are terminologies used for Search in SP 2013. Display Templates Display Templates are used with CSWP to format/style search result generated by CSWP search query. Display Templates control which managed property is shown in the search results and how they appear in the Web Part. Each Display Template ...


4

You need to render the rich text. Just add STSHtmlDecode like in this example. <div id="trimmedDetailsDiv" class="newsListItemBody" style="padding-right: 0px; color:#656565; font-size:15px; padding-bottom: 25px;"> _#= STSHtmlDecode(shortDescription.value) =#_ </div> SharePoint 2013 - Working with Display Template for Content Search Web Part ...


4

Make sure you have published the HTML-file of your new display template, so that the HTML-file and the generated JavaScript-file can be accessed by all users. The files of your display template should be located at: <siteurl>/_catalogs/masterpage/Display%20Templates/Content%20Web%20Parts


4

You can retrieve it from the DataProvider object. Which is accessible from within your display template. ctx.DataProvider.get_currentQueryState() This returns an object which gives you the whole search query context, like: keyword, sorting, refinement, ... In your case you want to extract the keyword, which you can retrieve from the property like this: ...


4

It can be achieve different ways. Quick way is combination of default JavaScript object and SharePoint page variable. var url = window.location.protocol + "//" + window.location.host + _spPageContextInfo.siteServerRelativeUrl; SharePint client Context - 1 function GetSiteUrl() { var ctx = new SP.ClientContext(); var site = ctx.get_site(); ctx.load(site); ...


4

You should be able to override the element using some CSS. However, as the style is inside the HTML you would need to use the !important parameter to override the inline style. .ms-srch-hover-outerContainer { left:400px !Important; } Or you should be able to fix it with some jQuery. $( document ).ready(function() { $(".ms-srch-hover-outerContainer")....


3

You need to use JSOM or REST to get the item. This in return means you must implement some kind of asynchronous behavior in GetDetailInfo. For example (usin jQuery ajax): function GetDetailInfo(itemID, callback) { $.ajax({ url: "/_api/Web/Lists/getByTitle('EmployeeDetailInfo')/Items/getById(" + itemID + ")", headers: { Accept: "application/...


3

The overrideValueRenderer method will, as the name suggests, override the value retrieved from the managed property. Out-of-the-box there are a couple of default override functions available like the $contentLineText one. In the $contentLineText the value length will be checked, and by default if it is greater than 90 characters, it will be trimmed. So in ...


3

I changed this data-displaytemplate="DefaultItem" to this data-displaytemplate="BillCycleItem" then it works fine!


3

If you're bulding your own custom template, get hold of one of the templates from the '_catalogs\masterpage\Display Templates' and modify it. Inside ManagedPropertyMapping add an Author property. Then within your template you could use something like: ms_outHtml.push(' ' ,' <img class="authorImage" src="/_layouts/15/userphoto.aspx?size=S&...


3

I must admit I tried your answer DarrylGodden and didn't get much luck with it. However I did find using the Srch.ContentBySearch.getPictureMarkup that I was able to put my own class in. In the example below I show you how to do this. I have also included other lines of code required to get the values to pass into getPictureMarkup. //Get the client ...


3

Why would you not use the fact that _catalogs is a virtual directory in SharePoint and reference it like this: <scrit type="text/javascript" src="/_catalogs/15/masterpage/Display%20Templates/Filters/Filter_Default.js"> </script> (notice the slash at first, and the 15 telling Sharepoint to look at the 15 hive instead of the 14 hive from 2010) I ...


3

EDIT Creating var var listPath = ctx.CurrentItem.Path; //Get Path if (listPath.indexOf("Lists/") >= 0) { //If contains List/ var afterLists = listPath.substring(listPath.lastIndexOf("Lists/")+6); //get url after "Lists/" var listTitle = afterLists.split('/'); // split listTitle[0] = listTitle[0].replace("_", " "); //get list title and replace _ with " " ...


3

As I mentioned in the comment, the approach which I would suggest is via a call to the list REST endpoint to retrieve the title. The endpoint to call is the following: tenant.sharepoint.com/_api/Lists(guid'4d46792d-0fd0-4850-aa29-4f3ea8310ac4')?$select=Title Here is an example item display template of how I achieved it: <html xmlns:mso="urn:schemas-...


3

Since a view for Issue Tracking list is rendered as a table you could use the CSS to define column width, for example: tr.ms-viewheadertr th:nth-child(5) { min-width: 200px; } Note: The column is selected by its index using :nth-child Result Probably the easiest way to apply the changes would be to insert the specified CSS (do not forget enclose it ...


Only top voted, non community-wiki answers of a minimum length are eligible