Looked at this a little more closely, and I see what's up.
Two important things when using idMemoize: you have to attach it to a place in
the DOM (otherwise it never captures any content to rerender) and the template
that it captures consists of the *children* of wherever you attach it. So, in that
example, we have:
<div data-lift="Results">
<ul>
<li>Result 1</li>
</ul>
</div>
And, the idMemoize just looks like:
var searchResults = SHtml.idMemoize(renderer => PassThru)
The bind is:
def render() ={
"#search-field" #> SHtml.ajaxText(searchTerm, updateResults)
}
First off, we want to attach the idMemoize to a particular point. To do
that, we add an id:
<div id="results" data-lift="Results">
<ul>
<li>Result 1</li>
</ul>
</div>
And then attach it:
def render() ={
"#search-field" #> SHtml.ajaxText(searchTerm, updateResults) &
"#results" #> searchResults
}
Unfortunately, this means the idMemoize captures the *children* of the
results div, so it captures:
<ul>
<li>Result 1</li>
</ul>
So while the first time it runs, we execute the Results snippet, when
we re-render the template, there's no snippet invocation in the captured
content! We can fix this by pushing the snippet into the `ul` instead:
<div id="results">
<ul data-lift="Results">
<li>Result 1</li>
</ul>
</div>
That does what we expect it to. Give it a shot and let me know if that helps!
Thanks,
Antonio