emposha / FCBKcomplete

Jquery facebook like(fancy) multi-select
http://www.emposha.com
383 stars 115 forks source link

Simple error with fix: _elem.search is not a function #60

Closed tedberg closed 13 years ago

tedberg commented 13 years ago

Version 2.8.3: The cache.search function has a bug:

$.each(element.data(), function (i, _elem) {         
    if (_elem.search(text) != -1) {
        temp.push({'key': i, 'value': _elem});
    }
});

Element.data() contains the key/value pairs that came back from the server, but also a reference to the Select control itself. Here's the simple fix:

$.each(element.data(), function (i, _elem) {
    if (typeof _elem.search === 'function') {
        if (_elem.search(text) != -1) {
              temp.push({'key': i, 'value': _elem});
          }
    }
  });
emposha commented 13 years ago

Thanks. just pushed your fix.