take your display template skills to the next level
Post on 16-Jul-2015
362 Views
Preview:
TRANSCRIPT
Sorry, something went wrong
Elio Struyf
”I’m a consultant with a passion
for branding and development”
Contact
@eliostruyf
www.eliostruyf.com
elio.struyf@ventigrate.be
Elio StruyfSenior SharePoint Consultant
Thank You to Our Sponsors!
• Getting syntax highlighting
• Sorting results
• Refreshing results
• Loading more results
• Grouping results
Intellisense
Syntax Highlighting
HTML
Comment - JS
what comes next?object.tostring()object.tostring()object.getId() or object.GetId()
Options & Methods
• Copy & paste
• Removing the comments and adding them back before saving
• Create JS display templates
• Create a separate JavaScript file
• SynWrite supports multiple lexers in one file
• Is there another option?
Srch.U.registerRenderTemplateByName
Srch.U.getRenderTemplateCollectionSrch.U.getRenderTemplateByName
Creating a retrieval function
1. Create a function in the script block
2. Write your code in this function
3. Register your function with: registerRenderTemplateByName
4. Call your function with: getRenderTemplateCollection
Adding sort actions to your
display templates
#One -
REST API - Sortable_api/search/query?querytext='*'&sortlist=‘Created:ascending'
REST API – Not sortable_api/search/query?querytext='*'&sortlist=‘Title:ascending'
#Two -
Adding your sorting options
d: 0 ascendingd: 1 descending
How to implement something like this
Refreshing your results
Could be useful when building dashboard pages
Interval
Manually
By default you have paging
What if you could do this
Maximum of 50 items
Another way to achieve it
Result container
1. Result 12. Result 23. Result 34. Result 4
Search Result Web Part
Hidden container
1. Result 12. Result 2
Move results
Load moreLoad moreLoad more
1. Result 32. Result 4
http://elst.es/1xiOUVL
Where is the grouping option?
Content Query Web Part
What needs to be done?
#One - Control display templateCreate a new object to store each retrieved item
#Two - Item display templateRetrieve the managed property values
Place each item in the grouping object
#Three - Control display templateDisplay the results from that object
https://github.com/SPCSR/
http://www.eliostruyf.com
”I’m a consultant with a passion
for branding and development”
Contact
@eliostruyf
www.eliostruyf.com
elio.struyf@ventigrate.be
Elio StruyfSenior SharePoint Consultant
top related