Skip to content

Commit

Permalink
Version 1.7.3
Browse files Browse the repository at this point in the history
- Fixes #12 Using a numeric display was causing an error.

Note
- Added debug on invalid source.data
  • Loading branch information
t_bertrand committed Nov 24, 2014
1 parent bd08e83 commit 7d15271
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
43 changes: 35 additions & 8 deletions jquery.typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* jQuery Typeahead
*
* @author Tom Bertrand
* @version 1.7.2 (2014-11-15)
* @version 1.7.3 (2014-11-24)
*
* @copyright
* Copyright (C) 2014 RunningCoder.
Expand Down Expand Up @@ -178,9 +178,20 @@
};
}

// {debug}
if ("data" in options[option][group] && !options[option][group].data) {
options.debug && window.Debug.log({
'node': node.selector,
'function': 'extendOptions()',
'arguments': "{options.source}",
'message': 'ERROR - source.group.data is defined but empty'
});
}
// {/debug}

// {debug}
if (!options[option][group].url && !options[option][group].data) {
_options.debug && window.Debug.log({
options.debug && window.Debug.log({
'node': node.selector,
'function': 'extendOptions()',
'arguments': "{options.source}",
Expand Down Expand Up @@ -395,7 +406,7 @@
storage[group][i].display = storage[group][i][options.display];
}

_display = storage[group][i].display;
_display = storage[group][i].display.toString();

if (!_display) {

Expand Down Expand Up @@ -451,7 +462,7 @@
_sort(
"display",
options.order === "asc",
function(a){return a.toUpperCase()}
function(a){return a.toString().toUpperCase()}
)
);
}
Expand Down Expand Up @@ -502,6 +513,10 @@

(function (result, scope) {

if (typeof result.display !== "string") {
result.display += "";
}

var _group,
_list,
_liHtml,
Expand Down Expand Up @@ -945,9 +960,22 @@
}

if (!options.source[group].data && !options.source[group].url) {
options.source[group] = {
url: options.source[group]
};

if (typeof options.source[group] === "string") {
options.source[group] = {
url: options.source[group]
};
} else {
// {debug}
options.debug && window.Debug.log({
'node': node.selector,
'function': 'generate()',
'arguments': '{source: undefined}',
'message': 'ERROR - Source for group "' + group + '" is undefined.'
});
window.Debug.print();
// {/debug}
}
}

storage[group] = [];
Expand Down Expand Up @@ -1674,7 +1702,6 @@

};


/**
* @public
* jQuery public function to implement the Typeahead on the selected node.
Expand Down
Loading

0 comments on commit 7d15271

Please sign in to comment.