Fredrik Malmborg April 9 2013 00:09:52
I have a searchform that sends the query to a view with some simple AJAX. The result is displayed in a div below the search filter without reloading the page from the server.
The result is formatted by a $$SearchTemplateDefault and using "Treat view content as HTML". In the view I generate HTML for table rows and cells.
The $$SearchTemplateDefault also got search specific fields like TotalHits that I use for pagination and more.
I came up with the following solution that is very easy to implement and lets you reuse much of what you already have created.
1. Put the content you want from the $$SearchTemplateDefault inside a div.
2. Modify the code that processes results from the AJAX call. Extracting the content from inside the div we just created in the $$SearchTemplateDefault.
Looking at the resulting HTML after the AJAX call, we now see that it is clean and bright. The search result is embedded nicely and without the Domino generated HTML we dont want in this setup.
This trick can be used in many other cases. For example you could use it to get a list from a $$ViewTemplate for a categorized view.
Maybe you noticed the DOCTYPE being used. It is not optimal for IE10 but that is another story.
Some will probably prefer to use JSON instead, but that will force you to change a lot more of the code you already have.