Group display templates

Hi all
I am implementing a search-driven carousel in SharePoint Online 2013 Preview like this one: http://www.blendmaster.net/blog/2012/11/search-driven-twitter-bootstrap-carousel-in-sharepoint-2013/.
Unlike that one, I am implementing it using the Search Results web part, not the Content Search web part, because the latter one isn't available in SharePoint Online 2013 Preview.
It is working, however, as well as customising the control and item display templates, I am wanting to customise the group display template; however, I can't find how to "register" the group display template.
Does anyone know how to associate a group display template with a control display template or, alternatively, how to associate the group display template with the Search Results web part?
Regards,
Chris

Are group templates even available in the CSWP Display templates? It seems I saw on this blog a reference of OOTB templates and only saw a group template for the Search Results Web Part. I have read other posts where you could actually inject a group template
into the CSWP. Even with that I do not see any examples of how to build the query rule and result block so that you can group results using the CSWP.
Am I barking up the wrong tree with trying to roll-up content using the CSWP? It seems that everyone wants to group their results like they did using the CQWP but this seems to be very difficult or not well documented. I, for one, have been struggling with
this for weeks without any success. This should not be so difficult.
If we don't use the CSWP for content roll-up then what are my other options for cross site-collection roll-ups?

Similar Messages

  • Sharepoint 2013 custom search results grouping display template

    Hi,
    I am trying to implement custom grouping for search result items. I would like to group them by a managed property, but without using result blocks (query rules). The idea is to sort the results by the property and then compare the current item (ctx.CurrentItem)
    with the previous item using ctx.CurrentItem.ParentTableReference. If a new property value is detected we insert a new 'group header' (just some simple html). The problem is the ParentTableReference is undefined. Shouldn't there be such a property in current
    item object?
    I'm implementing this in a custom search result item display template...
    Thanks in advance.

    Hi,
    According to your post, my understanding is that you want to customize search result items display template.
    I suggest you get enumerate all properties of JavaScript context object and debug you code to watch the
    ctx.CurrentItem object.
    The following articles for your reference:
    Debugging Display Templates in SharePoint 2013 Search
    http://powersearching.wordpress.com/2013/01/25/debugging-display-temlates-in-sharepoint-2013-search/
    Enumerate all properties of JavaScript context object in display templates in SharePoint 2013
    http://sadomovalex.blogspot.co.uk/2013/06/enumerate-all-properties-of-javascript.html
    How to Define a Custom Group Display Template (GroupTemplateId) for the Search Results WebPart via JavaScript
    http://www.eliostruyf.com/how-to-define-a-custom-group-display-template-for-the-search-results-webpart-via-javascript/
    Creating customized search results in SharePoint 2013
    http://www.abelsolutions.com/totm/creating-customized-search-results-in-sharepoint-2013/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Using Office 2013 group policy template to define Trusted Locations and Template Locations doesn't work

    User Configuration/Policies/Administrative Templates
    - Using Office 2013 group policy template to define Trusted Locations and Template Locations doesn't work
    Microsoft Word 2013/Word Options/Security/Trust Center/Trusted Locations
    - Allow Trusted Locations on the network: 
    Enabled 
    - Trusted Location #1: 
    Enabled 
    Path:  //server/sharedfoldername   [Edit:  Path:
    \\server\sharedfoldername]
    Date: June 10, 2013
    Description: Trusted Location
    Allow sub folders: Enabled
    The policy appears to apply to the client correctly by adding the following registry key and values:
    HKEY_CURRENT_USER\Software\Policies\Microsoft\office\15.0\word\security\trusted locations\location1
    allowsubfolders: 1
    date: June 10, 2013
    Description: Trusted Location
    Path:  //server/sharedfoldername  [Edit: Path: 
    \\server\sharedfoldername]
    However, when you open Word Options/Trust Centre/Trust Centre Settings…/Trusted Locations
    There are no trusted locations listed under ‘Policy Locations’
    I have tried setting similar settings for setting the Shared Templates folder location and just like the trusted locations policy, the registry keys are created properly in HKEY_CURRENT_USER\Software\Policies however word doesn’t
    seem to recognize these either.
    This used to work flawlessly using the administrative templates for Word 2007 and 2010. Has anyone been able to get these policies to apply successfully, or know why office doesn’t recognize these settings from the Policies registry
    Key?

    This would have been an easy solution to the issue.  Unfortunately it isn't the problem.  This question was originally posted on another Microsoft site and
    was transferred here and when it was transferred the path's changed from the original post: 
    \\server\sharedfodlername to //server/sharedfoldername.  (I will edit the question to show up as it did in the original post) Not sure how that happened.  This
    is still an issue that I haven't been able to get working correctly.
    As it turns out the 'New from Template' interface Word 2013 has developed is very bulky with large thumbnails and is not very customizable nor practical for an office
    that has a large number of templates.   Because I am unsatisfied with the display and performance of the 'New' template chooser I sought after a solution to change the way word creates a document from a template in another thread: 
    http://answers.microsoft.com/en-us/office/forum/office_2013_release-word/how-can-you-change-the-display-of-templates-in/d49194b9-a6b4-4768-8502-7d7b50e9dd65 working through this issue with Jay we were able to develop
    some VB script with handles a very large number of templates in a list view and it works much faster than the built-in Word interface.  The above thread is how I've worked around trying to define a shared template location and I am quite happy with it.

  • SharePoint 2013 Search Display Template People Search Mobile Phone

    Hello,
    I'd like to customize the people search result page. I already added some custom profile properties without any problem. But, when adding the MobilePhone field nothing is display.
    I've created a new display template based on the "Item_Person.html" file. 
    Added the "MobilePhone" field in the ManagedPropertyMapping section
    <mso:ManagedPropertyMapping msdt:dt="string">&#39;WorkPhone&#39;:&#39;WorkPhone&#39;,&#39;MobilePhone&#39;:&#39;MobilePhone&#39;,&#39;Room&#39;:&#39;Room&#39;,&#39;Werkgebieden&#39;:&#39;Werkgebieden&#39;,&#39;AboutMe&#39;:&#39;AboutMe&#39;,&#39;AccountName&#39;:&#39;AccountName&#39;,&#39;BaseOfficeLocation&#39;:&#39;BaseOfficeLocation&#39;,&#39;Department&#39;:&#39;Department&#39;,&#39;HitHighlightedProperties&#39;:&#39;HitHighlightedProperties&#39;,&#39;Interests&#39;:&#39;Interests&#39;,&#39;JobTitle&#39;:&#39;JobTitle&#39;,&#39;LastModifiedTime&#39;:&#39;LastModifiedTime&#39;,&#39;Memberships&#39;:&#39;Memberships&#39;,&#39;PastProjects&#39;:&#39;PastProjects&#39;,&#39;Path&#39;:&#39;Path&#39;,&#39;PictureURL&#39;:&#39;PictureURL&#39;,&#39;PreferredName&#39;:&#39;PreferredName&#39;,&#39;Responsibilities&#39;:&#39;Responsibilities&#39;,&#39;Schools&#39;:&#39;Schools&#39;,&#39;ServiceApplicationID&#39;:&#39;ServiceApplicationID&#39;,&#39;SipAddress&#39;:&#39;SipAddress&#39;,&#39;Skills&#39;:&#39;Skills&#39;,&#39;UserProfile_GUID&#39;:&#39;UserProfile_GUID&#39;,&#39;WorkEmail&#39;:&#39;WorkEmail&#39;,&#39;WorkId&#39;:&#39;WorkId&#39;,&#39;YomiDisplayName&#39;:&#39;YomiDisplayName&#39;</mso:ManagedPropertyMapping>
    3. Added a variable:
    var has_MobilePhone = !$isEmptyString(ctx.CurrentItem.MobilePhone)
    4. Copied the "WorkPhone" display section and changed the values to MobilePhone
    <!--#_
    if(has_MobilePhone == true) {
    _#-->
    <div id="MobilePhoneField">
    <!--#_
    var encodedMobilePhone = ctx.CurrentItem.MobilePhone;
    var displayMobilePhone = Srch.U.getSingleHHXMLNodeValue(hhProps, "MobilePhone");
    if ($isEmptyString(displayMobilePhone)) { displayMobilePhone = encodedMobilePhone }
    _#-->
    <div id="MobilePhoneValue" class="ms-srch-ellipsis" title="_#= encodedMobilePhone =#_">MobilePhone: _#= displayMobilePhone =#_ </div>
    </div>
    <!--#_
    _#-->
    Unfortunally the mobilephone does not appear in my search results. 
    What did I missed?

    First of all thank you for this quick reply.
    I changed all the properties from MobilePhone to CellPhone, but without result.
    <mso:ManagedPropertyMapping msdt:dt="string">&#39;WorkPhone&#39;:&#39;WorkPhone&#39;,&#39;CellPhone&#39;:&#39;CellPhone&#39;,&#39;Room&#39;:&#39;Room&#39;,&#39;Werkgebieden&#39;:&#39;Werkgebieden&#39;,&#39;AboutMe&#39;:&#39;AboutMe&#39;,&#39;AccountName&#39;:&#39;AccountName&#39;,&#39;BaseOfficeLocation&#39;:&#39;BaseOfficeLocation&#39;,&#39;Department&#39;:&#39;Department&#39;,&#39;HitHighlightedProperties&#39;:&#39;HitHighlightedProperties&#39;,&#39;Interests&#39;:&#39;Interests&#39;,&#39;JobTitle&#39;:&#39;JobTitle&#39;,&#39;LastModifiedTime&#39;:&#39;LastModifiedTime&#39;,&#39;Memberships&#39;:&#39;Memberships&#39;,&#39;PastProjects&#39;:&#39;PastProjects&#39;,&#39;Path&#39;:&#39;Path&#39;,&#39;PictureURL&#39;:&#39;PictureURL&#39;,&#39;PreferredName&#39;:&#39;PreferredName&#39;,&#39;Responsibilities&#39;:&#39;Responsibilities&#39;,&#39;Schools&#39;:&#39;Schools&#39;,&#39;ServiceApplicationID&#39;:&#39;ServiceApplicationID&#39;,&#39;SipAddress&#39;:&#39;SipAddress&#39;,&#39;Skills&#39;:&#39;Skills&#39;,&#39;UserProfile_GUID&#39;:&#39;UserProfile_GUID&#39;,&#39;WorkEmail&#39;:&#39;WorkEmail&#39;,&#39;WorkId&#39;:&#39;WorkId&#39;,&#39;YomiDisplayName&#39;:&#39;YomiDisplayName&#39;</mso:ManagedPropertyMapping>
    var has_CellPhone = !$isEmptyString(ctx.CurrentItem.CellPhone)
    <!--#_
    if(has_CellPhone == true) {
    _#-->
    <div id="CellPhoneField">
    <!--#_
    var encodedCellPhone = ctx.CurrentItem.CellPhone;
    var displayCellPhone = Srch.U.getSingleHHXMLNodeValue(hhProps, "CellPhone");
    if ($isEmptyString(displayCellPhone)) { displayCellPhone = encodedCellPhone }
    _#-->
    <div id="CellPhoneValue" class="ms-srch-ellipsis" title="_#= encodedCellPhone =#_">CellPhone: _#= displayCellPhone =#_ </div>
    </div>
    <!--#_
    _#-->
    Can you please tell me what I need to change?

  • How to create a Display template for people search results

    Hi,
    I've just installed Sharepoint 2013 and started to play around with it. Seems to be many improvements - among these are the ability to create Display templates.
    On my publishing page there is a default "employee lookup" app which returns prefferred name, title and department as default when I try to search.
    I would love to return mobile number aswell so I have tried to do the following:
    I made a copy of Display _Catalogs/Masterpages/Display Templates/Search/Item_Person.html
    Edited that one with the following:
    1. Added 'MobilePhone':'MobilePhone' to the "Managed Property mapping" in the top of the html   document:
    <mso:ManagedPropertyMapping msdt:dt="string">'AboutMe':'AboutMe','AccountName':'AccountName','BaseOfficeLocation':'BaseOfficeLocation','Department':'Department','HitHighlightedProperties':'HitHighlightedProperties','Interests':'Interests','JobTitle':'JobTitle','LastModifiedTime':'LastModifiedTime','Memberships':'Memberships','MobilePhone':'MobilePhone','PastProjects':'PastProjects','Path':'Path','PictureURL':'PictureURL','PreferredName':'PreferredName','Responsibilities':'Responsibilities','Schools':'Schools','ServiceApplicationID':'ServiceApplicationID','SipAddress':'SipAddress','Skills':'Skills','UserProfile_GUID':'UserProfile_GUID','WorkEmail':'WorkEmail','WorkId':'WorkId','YomiDisplayName':'YomiDisplayName'</mso:ManagedPropertyMapping>
    2. Set a var in the <body> with:
    var has_MobilePhone = !$isEmptyString(ctx.CurrentItem.MobilePhone);
    Created the following based on "DepartmentField":
    if(has_MobilePhone == true) {
    _#-->
    <div id="MobilephoneField">
    <!--#_
    var encodedMobilePhone = $htmlEncode(ctx.CurrentItem.MobilePhone);
    var displayMobilePhone = Srch.U.getSingleHHXMLNodeValue(hhProps, "MobilePhone");
    if ($isEmptyString(displayMobilePhone)) { displayMobilePhone = encodedMobilePhone}
    _#-->
    <div id="MobilePhoneValue" class="ms-srch-ellipsis" title="_#= encodedMobilePhone =#_"> _#= displayMobilePhone =#_ </div>
    </div>
    <!--#_
    Saved the document to the masterpage galary and edited the search result page to (people search core results webpart) to "use a single template to display items" and selected my display template.
    Now the search result is still working but I get no mobile numbers to show up in the user info (only in the details which is default).
    Anyone has some bright ideas of what i'm missing?. I'm not used to code (which might be the cause :-)). If you also have an idea on how to make the value of the number = Mobile: <mobilenumber>. So the "Mobile:" static text is displayed
    aswell.
    Thanks a lot for your time.

    Hello,
    I did the same with my new SharePoint 2013 (I would like to display the mobile phone too) but without any chance. Have you done anything else ?
    This is my User Property "CellPhone" :
    http://www.cladstrife.com/CellPhone_Prop.png
    The ManagedPropertyMapping :
    <mso:ManagedPropertyMapping msdt:dt="string">'AboutMe':'AboutMe','AccountName':'AccountName','BaseOfficeLocation':'BaseOfficeLocation','Department':'Department','HitHighlightedProperties':'HitHighlightedProperties','Interests':'Interests','JobTitle':'JobTitle','LastModifiedTime':'LastModifiedTime','Memberships':'Memberships','PastProjects':'PastProjects','Path':'Path','PictureURL':'PictureURL','PreferredName':'PreferredName','Responsibilities':'Responsibilities','Schools':'Schools','ServiceApplicationID':'ServiceApplicationID','SipAddress':'SipAddress','Skills':'Skills','UserProfile_GUID':'UserProfile_GUID','WorkEmail':'WorkEmail','WorkId':'WorkId','YomiDisplayName':'YomiDisplayName','CellPhone':'CellPhone','HomePhone':'HomePhone'</mso:ManagedPropertyMapping>
    The "if_exist" variable :
    var has_cphone = !$isEmptyString(ctx.CurrentItem.CellPhone);
    And the "display" code :
    <!--#_
    if(has_cphone == true) {
    _#-->
    <div id="CPhoneField">
    <!--#_
    var encodedCPhone = $htmlEncode(ctx.CurrentItem.CellPhone);
    var displayCPhone = Srch.U.getSingleHHXMLNodeValue(hhProps, "CellPhone");
    if ($isEmptyString(displayCPhone)) { displayCPhone = encodedCPhone}
    _#-->
    <div id="CPhoneValue" class="ms-srch-ellipsis" title="_#= encodedCPhone =#_"> Mobile: _#= displayCPhone =#_ </div>
    </div>
    <!--#_
    _#-->
    If I delete the test lines in the display code (if(has_cphone == true) it show "Mobile:" but without any mobile number.
    Thanks for your help if any idea :)
    Best regards
    Gabriel

  • Get current logged in user in sharepoint 2013 hover display template

    Hi,
    Can somebody tell me how the current logged in username can be retreived in hover display template to be used in search result.
    i tried using rest api but that is very difficult to get as it is to be done using ajax call and if we do getting a return value asynchronous is difficult.
    Please help

    Hello,
    You might use the function used in the Visual Studio SharePoint App template:
    var context = SP.ClientContext.get_current();
    var user = context.get_web().get_currentUser();
    $(document).ready(function () {
    getUserName();
    function getUserName() {
    context.load(user);
    context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);
    function onGetUserNameSuccess() {
    $('#message').text('Hello ' + user.get_title());
    function onGetUserNameFail(sender, args) {
    alert('Failed to get user name. Error:' + args.get_message());

  • Error in Search results - Sorry, something went wrong. Display template had an error

    I'm receiving this error in custom search results page in our SharePoint 2013 Enterprise farm:
    Sorry, something went wrong.
    Display Error: The display template had an error. You can correct it by fixing the template or by changing the display template used in either the Web Part properties or Result Types.
    'console' is undefined (CoreRender: ~ sitecollection/_catalogs/masterpage/Display Templates/Search/Item_mycustom_Site.js
    I believe a similar error was resolved by March 2013 CU but our farm us running Aug 2013 CU. I have also tried adding domain to trusted zone in IE but still the same error.
    I do not get this error in Google Chrome or in IE 10 or above. Not sure if it is an issue with my display template because error disappears when upgrading IE to 10 or 11.
    Update: In IE 8 I can see search results with no error if the developer toolbar (F12) is enabled!
    -- The opinions expressed here represent my own and not those of anybody else -- http://manojvnair.blogspot.com

    Hi ,
    Did you try these steps
    Open up the SharePoint 2013 Management Shell as Administrator
    and run the following command:   Enable-SPFeature SearchWebParts -url http://<central admin
    url>
    Use a browser on a different machine, or add you SharePoint
    site(s) to the ‘Trusted Sites’ in IE.
    Activate the feature : “My
    Site Host“. This is a hidden feature scoped at the Site Collection level. The feature ID is 49571CD1-B6A1-43a3-BF75-955ACC79C8D8.
    The feature folder under SharePointRoot is MySiteHost.
    Install the update: http://www.microsoft.com/en-in/download/details.aspx?id=36989
    Here are some similar threads for you to take a look at:
    http://sharepoint.stackexchange.com/questions/70452/query-builder-for-result-source-not-working-in-central-admin
    http://www.thesharepointbaker.co.uk/sharepoint-2013-gotchas-2/
    http://bernado-nguyen-hoan.com/page/2/
    Ref:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/6e86cf3f-8001-4d13-a700-9e70d8828f03/controlsearchboxjs-not-found?forum=sharepointsearch

  • Item display templates office 365 not showing in sharepoint designer

    Hi,
    I have an enterprise search site in O365. I can brows to Masterpage > Display Templates > Search in the browser and see the .html & .js file.  If I brows to the same location in SharePoint designer, the files do not display.  How do I
    see/edit the files in SP designer?
    Thx!

    Hi Lorena,
    Add an image of the path, All Files (and pin button)->_catalogs->masterpage library.
    Thanks
    Daniel Yang
    TechNet Community Support

  • Access query strings in a search results page with custom display template

    am trying to create a  custom display template in my search results page , so i went to download the itemdefault html file and renamed it and  saved as  different file.and  am started to updating.
    the issue i am facing here is : in my  search results page there are 2 query strings, which are passed by anotehr .net appln[ another asp.net appln will be sending the query string to my sp 2013 search results page]
    but, how can i  read these 2  query strings using jslink and  new token _#- ? 
             <!--#_
               var QStringResults= null;
    ctx.OnPostRender = [];
    ctx.OnPostRender.push(function(){ 
    QStringResults= getQuString(); //here am unable to read the QStringResults value 
     _#-->  
    the below is my cstomhtml file
    am unable to  get the values :
                   <a href="http://srvrname:2013/sites/CMP/_layouts/15/BIFAddInputRef/bifpage1.aspx?bif1=_#= $htmlEncode(QStringResults) =#_"> Add Input Reference </a>
    <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"> 
    <head>
    <title>Item BIF</title>
    <!--[if gte mso 9]><xml>
    <mso:CustomDocumentProperties>
    <mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
    <mso:MasterPageDescription msdt:dt="string">Displays the default result item template.</mso:MasterPageDescription>
    <mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
    <mso:TargetControlType msdt:dt="string">;#SearchResults;#</mso:TargetControlType>
    <mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
    <mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension','DisplayAuthor':'DisplayAuthor','CMPBIFURL2':'CMPBIFURL2'</mso:ManagedPropertyMapping>
    <mso:_dlc_DocId msdt:dt="string">X3CVW7PXYF6P-3-222</mso:_dlc_DocId>
    <mso:_dlc_DocIdItemGuid msdt:dt="string">3ed12157-ea19-4591-b9cd-7a826aef35dc</mso:_dlc_DocIdItemGuid>
    <mso:_dlc_DocIdUrl msdt:dt="string">http://srvrname:2013/sites/CMP/_layouts/15/DocIdRedir.aspx?ID=X3CVW7PXYF6P-3-222, X3CVW7PXYF6P-3-222</mso:_dlc_DocIdUrl>
    </mso:CustomDocumentProperties>
    </xml><![endif]-->
    </head>
    <body>
        <script>
            $includeLanguageScript(this.url,"~sitecollection/_catalogs/masterpage/Display Templates/Search/BIFJScript.js");
        </script>
        <div id="Item_BIF2">
    <!--#_ 
            if(!$isNull(ctx.CurrentItem) && !$isNull(ctx.ClientControl)){
                var id = ctx.ClientControl.get_nextUniqueId();
                var itemId = id + Srch.U.Ids.item;
    var hoverId = id + Srch.U.Ids.hover;
    var hoverUrl = "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Default_HoverPanel.js";
                $setResultItem(itemId, ctx.CurrentItem);
    if(ctx.CurrentItem.IsContainer){
    ctx.CurrentItem.csr_Icon = Srch.U.getFolderIconUrl();
    ctx.currentItem_ShowHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
                ctx.currentItem_HideHoverPanelCallback = Srch.U.getHideHoverPanelCallback();
    _#-->
             <!--#_
               var QStringResults= null;
    ctx.OnPostRender = [];
    ctx.OnPostRender.push(function(){ 
    QStringResults= getQuString();
     _#-->  
            <div id="_#= $htmlEncode(QStringResults) =#_" name="bifItemqstring" 
                    data-displaytemplate="DefaultItem" class="ms-srch-item" 
                    >
                    <h5 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.Path =#_"> _#= ctx.CurrentItem.Path =#_</a>
                    </h5>
                </div>
                <div id="_#= $htmlEncode(itemId) =#_" name="bifItem" 
                    data-displaytemplate="DefaultItem" class="ms-srch-item" 
                    onmouseover="_#= ctx.currentItem_ShowHoverPanelCallback =#_" 
                    onmouseout="_#= ctx.currentItem_HideHoverPanelCallback =#_">
                    <h1 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.Path =#_"> _#= ctx.CurrentItem.Path =#_</a>
                    </h1>
                    <h4 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.Description =#_"> _#= ctx.CurrentItem.Description =#_</a>
                    </h4>
                    <h4 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.LastModifiedTime =#_"> _#= ctx.CurrentItem.LastModifiedTime =#_</a>
                    </h4>
                    <h3 style="color:floralwhite;background-color:green">
                        var mybifurl1= document.getElementById($htmlEncode(QStringResults));
                    <a href="http://srvrname:2013/sites/CMP/_layouts/15/BIFAddInputRef/bifpage1.aspx?bif1=_#= $htmlEncode(QStringResults) =#_"> Add Input Reference </a>
                    </h3>
                  </div>
            <div>
            </div>
                    <div id="_#= $htmlEncode(hoverId) =#_" class="ms-srch-hover-outerContainer"></div>
    <!--#_ 
    _#-->
        </div>
    </body>
    </html>
    when i run the page , i a getting the query string value as   undefined! though the custom javascript is getting called.

    i am able to get the  results  by implementing the below:
    <h4 style="background-color:black">
                        <a onclick="javascript:mycalltojs(_#=
    ctx.CurrentItem.Path=#_) > click here </a>
                    </h4>
    hope this helps  anyone

  • Content Search Web Part - display template Error

    Hi,
    I have an office 365 site, where in I have more than one Content Search Web Part and I have written custom display templates to be used in CSWP.
    Now, the issue is, whenever the page is browsed (intermittent in this case) and the page is edited to edit the CSWP (always in this case), the javascript files corresponding to the display templates are not loaded and because of which its throwing 'Sorry,
    something went wrong' error. 
    Thanks
    Senthil

    Hi Senthu,
    Any updates on this issue?
    Since there are articles describe how to customize template for content search web part, I'd recommend you refer to them and check/debug your script:
    http://blogs.technet.com/b/sharepoint_quick_reads/archive/2013/08/01/sharepoint-2013-customize-display-template-for-content-by-search-web-part-cswp-part-1.aspx
    http://blogs.technet.com/b/sharepoint_quick_reads/archive/2013/08/02/sharepoint-2013-customize-display-template-for-content-by-search-web-part-cswp-part-2.aspx
    If you suspect there is performance issue, you could test it on other browsers or machines.
    If the issue persists on reference in the script, please refer to the articles and try to find one which can meet your requirement.
    http://onlinecoder.blogspot.com/2013/10/localizing-cswp-display-templates-in.html
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Sharepoint Online - Content Search, some Display Templates missing.

    I'm experimenting Content Search web parts in a number of Site Collections, but appear to be getting different Display Templates available.
    Can anyone explain what controls the availability of the templates please...
    Our Default root site collection.
    http://company.sharepoint.com
    Has Web part controls of
    List & Slideshow
    And Item Templates of
    Large Picture, Picture on left 3 lines, Recommended Items & Video
    All other site collections  http://company.sharepoint.com/sites/Dept1
    Has Web part controls of List
    & Slideshow
    PLUS List with Paging
    And Item Templates of
    Large Picture, Picture on left 3 lines, Recommended Items & Video
    PLUS Diagnostic, Picture on Top 3 Lines bottom, & Two Lines
    I've compared site and collection features and cannot see any features that would appear to control this...
    Any ideas.... Please!
    Cheers
    Russ

    I just had the same issue, I think it was something with broken upgrade code from 2013.
    Anyways, I solved it:
    Go to Master Page Gallery --> Display Templates --> Content Web Parts
    Delete all JavaScript Files in there except the Group_Content.js (!!!), they seem to have messed up metadata (Content Type Reference and Template Level)
    Open up PowerShell and issue this command:
    Get-SPFeature SearchTemplatesandResources | Enable-SPFeature -Url [URLtoBrokenSite] -Force
    This will re-upload the JavaScript files and all controls and templates finally are there again, hopefully ;)
    // Tried and true method for weather forecasting - random numbers. String weather = (new Random()).Next(2)==0?"rainy":"sunny";

  • Search Results Clear On Refinement with custom Display Template

    I am working with a custom search display template. I did minor presentation changes in the template. I am showing a checkbox against each search item and there is some logic behind it.
    For this I am using Item_Default Template.
    ctx.OnPostRender = [];
    ctx.OnPostRender.push(function(){
    $('input[name=checkbox]').change(function(){
    //My Logic
    With this is in place, on page load it shows initial results just fine and my checkbox logic also works fine.
    However, whenever user hits a refinement value the results clear out and no longer display. I know the results are there because when I do reload of the page refined results appears but again when you click on refinement value results disappear.
    With some digging on the forums I found that use "AddPostRenderCallback(ctx,function(){" instead of "ctx.OnPostRender.push", I tried this as well but it didn't help.
    Whenever I remove "ctx.OnPostRender.push(function(){" code from my template, refinement panel starts working properly again. So there has to be something related to this "ctx.OnPostRender.push". I cant just
    remove it because I have to write my JS logic as well for that this function is must.
    Please give me some pointers.
    Thanks
    Sarvesh
    Regards Sarvesh Shinde SharePoint Developer, India

    i am able to get the  results  by implementing the below:
    <h4 style="background-color:black">
                        <a onclick="javascript:mycalltojs(_#=
    ctx.CurrentItem.Path=#_) > click here </a>
                    </h4>
    hope this helps  anyone

  • Custom display template for search

    HI 
    I have Created a custom Item Template as shown below.I want to map this with my custom result type but it is not working
    <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
    <head>
    <title>News Item</title>
    <!--[if gte mso 9]><xml>
    <mso:CustomDocumentProperties>
    <mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
    <mso:MasterPageDescription msdt:dt="string">$Resources:Microsoft.Office.Server.Search,DisplayTemplateDescription_SearchDefaultItem</mso:MasterPageDescription>
    <mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
    <mso:TargetControlType msdt:dt="string">;#SearchResults;#</mso:TargetControlType>
    <mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
    <mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension','SEDWMPNewsPublishDate':'SEDWMPNewsPublishDate','DisplayAuthor':'DisplayAuthor1','SiteTitle':'SiteTitle'</mso:ManagedPropertyMapping>
    <mso:HtmlDesignConversionSucceeded msdt:dt="string">True</mso:HtmlDesignConversionSucceeded>
    <mso:CrawlerXSLFile msdt:dt="string"></mso:CrawlerXSLFile>
    <mso:HtmlDesignPreviewUrl msdt:dt="string"></mso:HtmlDesignPreviewUrl>
    </mso:CustomDocumentProperties>
    </xml><![endif]-->
    </head>
    <body>
    <div id="StoraEnso_Item_Default">
    <!--#_
    if(!$isNull(ctx.CurrentItem) && !$isNull(ctx.ClientControl)){
    var id = ctx.ClientControl.get_nextUniqueId();
    var itemId = id + Srch.U.Ids.item;
    var hoverId = id + Srch.U.Ids.hover;
    var hoverUrl = "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Default_HoverPanel.js";
    $setResultItem(itemId, ctx.CurrentItem);
    if(ctx.CurrentItem.IsContainer){
    ctx.CurrentItem.csr_Icon = Srch.U.getFolderIconUrl();
    ctx.currentItem_ShowHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
    ctx.currentItem_HideHoverPanelCallback = Srch.U.getHideHoverPanelCallback();
    _#-->
    <div id="_#= $htmlEncode(itemId) =#_" name="SEItem" data-displaytemplate="StoraEnsoDefaultItem" class="ms-srch-item" onmouseover="_#= ctx.currentItem_ShowHoverPanelCallback =#_" onmouseout="_#= ctx.currentItem_HideHoverPanelCallback =#_">
    <h2 class="heading"><a href="_#= ctx.CurrentItem.Path =#_">_#= ctx.CurrentItem.Title =#_</a></h2>
    <div id="_#= $htmlEncode(hoverId) =#_" class="ms-srch-hover-outerContainer"></div>
    <p>_#= Srch.U.processHHXML(ctx.CurrentItem.HitHighlightedSummary) =#_</p>
    <div class="footer">
    <dl class="desc">
    <dt>SiteTitle</dt> _#= ctx.CurrentItem.SEDWMPNewsPublishDate =#_
    <dd><a class="status" href="#">_#= ctx.CurrentItem.SiteTitle =#_</a></dd>
    <dt>Author</dt>
    <dd><a class="status" href="#">_#= ctx.CurrentItem.DisplayAuthor =#_</a></dd>
    </dl>
    </div>
    </div>
    <!--#_
    _#-->
    </div>
    </body>
    </html>
    If you see in "managedPropertyMapping" I have added a new property "SEDWMPNewsPublishDate" and when I use in my html I am not getting the value.
    I checked with fiddler and I found that This property is not getting mapped. Json object does return this property.However  this property has value. I have tested with content search webpart nad my code also.it returns value.
    Can anyone let me know is there any issue in the above rendering template code 
    On update to this, I was using resultscript webpart on the page to display data and I have created custom result type to modify the display.What I found that when I add the custom properties which I need, on result script webpart  using as
    follows 
     scriptWebPart.SelectedPropertiesJson = "[\"SEDWMPNewsPublishDate\",\"SEDWMPIntroduction\"]"
    and save the changes then I start getting the value of my custom properties.
    I don't know how the result type works in accordance with display templates and when does it gets applied on the search data.If anyone is aware please let me know.
    If I can't use the display templates with custom properties then what is the use of ManagedPropertyMapping on display templates.Can anyone please make me understand?

    You need to update the js file also.You can upload the js file also.In js file you have a column "ManagedPropertyMapping" this denotes which managed property should come for item in search.
    For uploading the js file you can use as follows under module
     <File Path="ModSearchDisplayTemplates\x.js" Url="x.js" Type="GhostableInLibrary">
          <Property Name="Title" Value="xjs" />
          <Property Name="MasterPageDescription" Value="$Resources:Microsoft.Office.Server.Search,DisplayTemplateDescription_SearchDefaultItem" />
          <Property Name="ContentType" Value="$Resources:TemplateContentType_Code_Name" />
          <Property Name="DisplayTemplateLevel" Value="Item" />
          <Property Name="TemplateHidden" Value="0" />
          <Property Name="TargetControlType" Value=";#SearchResults;#" />
          <Property Name="HtmlDesignLockedFile" Value="TRUE" />
          <Property Name="ManagedPropertyMapping" Value="'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','FileExtension':'FileExtension','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SEDWMPNewsPublishDate00':'SEDWMPNewsPublishDate00','SEDWMPIntroduction':'SEDWMPIntroduction','SEDWMPNewsIsSticky':'SEDWMPNewsIsSticky','SEDWMPNewsPostThreadId':'SEDWMPNewsPostThreadId'"/>
        </File>

  • How to display the Author's Photo in a Display Template

    I am creating a custom display template that will show the date and contents of a blog post on the right, with a thumbnail of the author on the left. I cannot figure out how to retrieve the URL for the users photo from the display template.
    My first thought was that maybe there was a Managed Property I could choose in the property mappings. The Author Property will give me the Last Name, FirstName of the author. There is also a AuthorOWSUSER, which I thought might be an object with properties
    I could reference, like .FirstName, .Picture, etc. But this doesn't appear to work.
    My guess is that I have to do some scripting in the display template itself, but I just don't know where to find any references on this.

    Hi,
    I have done this in a Project before mounth. Create a Blog Post Site an attach with Visual Studio. There is a lib
    sp.ui.blogs.debug.js.
    When you load a Blog with comments, you can put a breakpoint and step Through.
    There is a Function, that renders the Photo from the Author Field.
    Hier is my code:
    function renderAuthor(ctx, $p1) {
    var $v_0 = SP.ScriptHelpers.getFieldFromSchema(ctx.ListSchema, 'Author');
    if (!SP.ScriptHelpers.isNullOrUndefined($v_0)) {
    var $v_1 = $v_0.WithPictureDetail;
    var $v_2 = $v_0.PictureOnly;
    $v_0.DefaultRender = 0;
    $v_0.WithPictureDetail = 0;
    $v_0.PictureOnly = 1;
    $v_0.PictureSize = 'Size_48px';
    $p1.write(spMgr.RenderFieldByName(ctx, 'Author', ctx.CurrentItem, ctx.ListSchema));
    $v_0.WithPictureDetail = $v_1;
    $v_0.PictureOnly = $v_2;
    It is very important that your Content Type Field has the Attribute ShowField="NameWithPictureAndDetails"
    Then you dont need to query UserProfile for Pictures, the info will be in the Fiedl.
    Chears
    Martin

  • Managed properties in display templates

    Hi
    I'm trying to include some custom managed properties (GlossaryProductString) into my custom display template but the ct.CurrentItem.GlossaryProductString is always undefined.
    What I did:
     Create managed property and mark it as retrievable
    Full crawl (I'm able to find results when using GlossaryProductString:"some content" as query)
    Downloaded the item_default.html and renamed it
    Added GlossaryProdcutString to the ManagedPropertyMapping properties ('GlossaryProductString':'GlossaryProductString')
    Add the content to the template:
    <p>Product: <span style="font-weight: 200">_#= ctx.CurrentItem.GlossaryProductString =#_</span></p>
    all other stuff that is needed that the display template is used
    The display template shows up for the results but the GlossaryProductString is always empty (undefined in JS object)
    Any ideas?
    Thanks for help.

    Hi
    The REST call returns the GlossaryProductString. Here an excerpt of the result:
    - <d:element m:type="SP.SimpleDataRow">
    - <d:Cells>
    - <d:element m:type="SP.KeyValue">
    <d:Key>Rank</d:Key>
    <d:Value>11.5733613967896</d:Value>
    <d:ValueType>Edm.Double</d:ValueType>
    </d:element>
    - <d:element m:type="SP.KeyValue">
    <d:Key>DocId</d:Key>
    <d:Value>725</d:Value>
    <d:ValueType>Edm.Int64</d:ValueType>
    </d:element>
    - <d:element m:type="SP.KeyValue">
    <d:Key>Title</d:Key>
    <d:Value>Argument</d:Value>
    <d:ValueType>Edm.String</d:ValueType>
    </d:element>
    - <d:element m:type="SP.KeyValue">
    <d:Key>Path</d:Key>
    <d:Value>https://sst-s13.ioztest.ch/glossary/Lists/Definitions/DispForm.aspx?ID=8</d:Value>
    <d:ValueType>Edm.String</d:ValueType>
    </d:element>
    - <d:element m:type="SP.KeyValue">
    <d:Key>GlossaryProductString</d:Key>
    <d:Value>Excel</d:Value>
    <d:ValueType>Edm.String</d:ValueType>
    </d:element>
    - <d:element m:type="SP.KeyValue">
    <d:Key>OriginalPath</d:Key>
    <d:Value>https://sst-s13.ioztest.ch/glossary/Lists/Definitions/DispForm.aspx?ID=8</d:Value>
    <d:ValueType>Edm.String</d:ValueType>

Maybe you are looking for