Sharepoint - JS Link - How to render search box in a custom list?

494 views Asked by At

I was working with JS Link in Sharepoint and managed to render a custom list. Here's a brief extract from the code:

context.Templates.View = RenderBodyTemplate;
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(context);

RenderBodyTemplate is a function, which will take context as its parameter and returns HTML markup as a string. Then, RegisterTemplateOverrides accomplishes the rendering.

So, the rendering worked fine, but then I needed a search box and search functionality for the custom list. I noticed there was a checkbox, which would display the search box for my custom list in its Properties window.

After setting the search box (this one)

enter image description here

visible without a JS Link, everything worked nicely out of the box. However, once I override the template with my custom markup using JS Link, the search box disappears. I know I'd have to render it separatedly somehow in Javascript, but how can it be done? How can I render the search box along with my custom list rendering, so that the search functionality also works?

0

There are 0 answers