Hi all,
I'm trying to integrate scrollspy (from Twitter bootstrap) with a list of elements I generate into the DOM based off of a computed variable exposed in my model. In my HTML, I use a simple foreach to spit out a series of divs, and assign each an ID based on a property on the binding object:
<div data-bind="foreach: VariableBackedByComputed">
<div data-bind="attr: {id: 'divid.' + uid}">
...
</div>
</div>
So that works fine, I get a series of divs, each with a unique ID. So, next step is to integrate scrollspy:
I can't simply use the declarative method described in the above link, because the DOM elements are not all present when the dom is first parsed. So, I can call $('#Element').scrollspy() once the elements are in the dom. And, I can call $('#Element').scrollspy('refresh') if I add/remove any elements to/from the DOM. I thought that I could just use a bindinghandler, but I'm not sure about this. Has anyone got this working, or does anyone have any suggestions of when and how to call .scrollspy and .scrollspy('refresh')?
Thanks...
-Ben