Как я могу искать объекты по нескольким свойствам (Knockout.js+ twitter bootstrap typeahead )?

Я в этот момент:)

http://blogs.msdn.com/b/rebond/archive/2012/07/18/knockout-js-binding-for-bootstrap-typeahead-plugin.aspx

// 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());
  }
 };

У меня есть класс X с 4 свойствами.

Я хочу искать массив объектов X по его 3 свойствам. (Идентификатор другого свойства)

Есть идеи?

5
задан ozz 22 July 2012 в 23:15
поделиться