Closed timprepscius closed 10 years ago
},
Could you give me some context? What problem does this solve?
Input: XXX, YYY, ZZZ, VVV works.
Example:
To:_____
And you start typing: Tim
Typeahead will correctly suggest: TimSalaBim
But then you type a tab, comma, I.
To: TimSalaBim, I
Typeahead will be confused. Whereas I want it to suggest IAmAComputer
So that when you press tab:
To: TimSalaBim, IAmAComputer
Here is some revised code:
There is a still a bug when the typed and the hint are greater length than the input box. (I think one of them has no scroll or something)
fixTypeAheadToWorkWithCommas: function (input) {
var z = $.data(input, 'ttTypeahead');
z.input.getInputValue = function() {
var s = z.input.$input.val();
var c = s.lastIndexOf(',');
return s.substr(c+1);
};
z.input.setInputValue = function(value_, silent) {
var value = value_.trim();
var s = z.input.$input.val();
var c = s.lastIndexOf(',');
var f = (c >= 0) ? (s.substr(0, c+1) + " " + value) : value;
z.input.$input.val(f);
};
z.input.setHintValue = function(value_) {
var value = value_.trim();
var s = z.input.$input.val();
var c = s.lastIndexOf(',');
var f = (c >= 0) ? (s.substr(0, c+1) + " " + value) : value;
z.input.$hint.val(f);
};
z.input.clearHint = function() {
z.input.setHintValue("");
};
// this causes things to lose their multi-value during onBlur
z.input.resetInputValue = function () {
//z.input.setInputValue(z.input.query);
}
},
So this doesn't fall within the scope of what I want to do with the existing typeahead.js jQuery plugin. In the future, I want to create additional plugins that will support this sort of functionality, but there's no timeframe for that.
In the meantime the tokenfield project from sliptree uses bootstrap and typahead to provide most of this functionality.
@timprepscius Were you able to find out a good way to hack this? I am in a situation where I would like your scenario to work.
@eduo :+1: looks great! Checking out tokenfield
Please add support for setting special characters to accept, like commas. I'm not using bootstrap so the tokenfield project won't work.
You might try looking at my project:
https://github.com/timprepscius/mv
I believe I made it tokenize without using tokenfield.
Perhaps look in: https://github.com/timprepscius/mv/tree/master/client/web/Ext/sliptree-bootstrap-tokenfield-9e935ef
https://github.com/timprepscius/mv/blob/master/client/web/WebContent/templates/composeTemplate.html
https://github.com/timprepscius/mv/blob/master/client/web/WebContent/js/view/ComposeView.js
Not sure if this will help.
-tim
On 3/7/16, depiction notifications@github.com wrote:
Please add support for setting special characters to accept, like commas. I'm not using bootstrap so the tokenfield project won't work.
Reply to this email directly or view it on GitHub: https://github.com/twitter/typeahead.js/issues/751#issuecomment-193406156
Oh, I see, not bootstrap. Sorry. Brain malfunction.
-tim
On 3/7/16, Tim Prepscius timprepscius@gmail.com wrote:
You might try looking at my project:
https://github.com/timprepscius/mv
I believe I made it tokenize without using tokenfield.
Perhaps look in: https://github.com/timprepscius/mv/tree/master/client/web/Ext/sliptree-bootstrap-tokenfield-9e935ef
https://github.com/timprepscius/mv/blob/master/client/web/WebContent/templates/composeTemplate.html
https://github.com/timprepscius/mv/blob/master/client/web/WebContent/js/view/ComposeView.js
Not sure if this will help.
-tim
On 3/7/16, depiction notifications@github.com wrote:
Please add support for setting special characters to accept, like commas. I'm not using bootstrap so the tokenfield project won't work.
Reply to this email directly or view it on GitHub: https://github.com/twitter/typeahead.js/issues/751#issuecomment-193406156
I'm using this hack I came up with, but perhaps typeahead would like to do this correctly.