I am opening Moda dialogue and then binding Tooltip on one link. On mouse hover, Tooltip displaying correctly but when hiding the tooltip then Modal Dialogue closing automatically.
<div class="modal fade hide" data-bind="viewSheet: selectedBus" id="divModel">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3 data-bind="text : Travel"></h3>
<a rel="tooltip" href="#" data-toggle="tooltip" data-placement="right"
data-bind="attr : {title : Travel}">
<i class="icon-info-sign"></i></a>
Cancellation Policy
</div>
<div class="modal-body">
<input />
</div>
<div class="modal-footer">
<a href="#" data-dismiss="modal">Close</a>
</div>
</div>
ko.bindingHandlers.viewSheet = {
init: function (element, valueAccessor) {
var data = valueAccessor();
//make sure that we clear the observable no matter how the modal is closed
$(element).modal({ show: false }).on("hidden", function () {
if (ko.isWriteableObservable(data)) {
data(null);
}
});
//wrap the real "with" binding
return ko.bindingHandlers["with"].init.apply(this, arguments);
},
update: function (element, valueAccessor) {
var data = ko.utils.unwrapObservable(valueAccessor());
//show or hide the modal depending on whether the associated data is populated
$(element).modal(data ? "show" : "hide");
$(element).on('shown', function () {
//$(element).find("[rel='tooltip']").popover();
$(element).find("[rel='tooltip']").tooltip();
});
//wrap the real "with" binding
return ko.bindingHandlers["with"].update.apply(this, arguments);
}
};