Gravatar for jpdery@coveo.com

Question by jpdery, Jun 25, 2014 2:04 PM

ResultFolding data-result-template-selector causes "Uncaught [Object object]"

Does not seem to work, or I don't know how to "adding a template directly in your HTML page and by passing the id attribute of this template".

re: https://developers.coveo.com/display/JsSearch/ResultFolding+Component

using attribute data-result-template-selector="#TranslatedContentChildResult", I get JavaScript "Uncaught [Object object]"

My template is simply declared in my html as :

< script id="TranslatedContentChildResult">
              <div class="coveo-title">
                  <a class="CoveoResultLink">zzz<%=Title?highlight(Title, titleHighlights):ClickUri%></a>
                </div>
            < /script>
1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, Jun 25, 2014 2:11 PM

Add the type text/x-underscore-template to your template script, so that the framework knows it's a result template.

 <script src="path/to/jssearch.dependencies.js" />
 <script id="TranslatedContentChildResult"  type="text/x-underscore-template">
   [content of the template]
 </script>
 <script >
   [init call]
 </script>

 <body>
   [...]
   <div class="CoveoResultList">
        <script class="result-template" type="text/x-underscore-template">
               <div class='CoveoResultFolding'
                   data-result-template-selector="#TranslatedContentChildResult">
               </div>
         </script>
   </div>
 </body>
Ask a question