大佬教程收集整理的这篇文章主要介绍了twitter-bootstrap – 如何在多个属性上搜索对象(knockout.js twitter bootstrap typeahead)?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
// Bootstrap.Typeahead binding: presently requires custom version from gist: https://gist.github.com/1866577. // Use like so: data-bind="typeahead: { target: SELEctedNamespace,source: namespaces }" ko.bindingHandlers.typeahead = { init: function(element,valueAccessor) { var binding = this; var elem = $(element); var value = valueAccessor(); // Setup Bootstrap Typeahead for this element. elem.typeahead( { source: function() { return ko.utilS.UnwrapObservable(value.sourcE); },onSELEct: function(val) { value.target(val); } }); // Set the value of the target when the field is blurred. elem.blur(function() { value.target(elem.val()); }); },update: function(element,valueAccessor) { var elem = $(element); var value = valueAccessor(); elem.val(value.target()); } };
任何的想法?
elem.typeahead({ source: function() { return ko.utilS.UnwrapObservable(value.sourcE); },onSELEct: function(val) { value.target(val); },matcher: function(item) { // check if it matches Foo,Bar,or Baz properties. return item.Foo.indexOf(this.query) >= 0 || item.bar.indexOf(this.query) >= 0 || item.baz.indexOf(this.query) >= 0; } });
以上是大佬教程为你收集整理的twitter-bootstrap – 如何在多个属性上搜索对象(knockout.js twitter bootstrap typeahead)?全部内容,希望文章能够帮你解决twitter-bootstrap – 如何在多个属性上搜索对象(knockout.js twitter bootstrap typeahead)?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。