Bootstrap popover with knockout.js

后端 未结 3 1606
离开以前
离开以前 2021-01-02 02:25

I\'ve got an application receiving some data through AJAX-call. After that, received data binds to DOM-elements using knockout.js library. I\'d like to use boostrap

3条回答
  •  隐瞒了意图╮
    2021-01-02 03:07

    Here is a complete working example with array of objects, I changed the ko.applyBindings() to ko.applyBindingsToDescendants to include the binding context $root and $parent when we would like to associate a button for example to a function in a root viewModel.

    $(element).click(function() {
                $(this).popover('toggle');
                var thePopover = document.getElementById(attribute.id+"-popover");
                childBindingContext = bindingContext.createChildContext(viewModel);
                ko.applyBindingsToDescendants(childBindingContext, thePopover);
        });
    

    Take a look @ http://jsfiddle.net/mounir/Mv3nP/6/

提交回复
热议问题