Comments (14)
Thanks @alexgorbatchev for a great plugin!
The bug occurs is in isValueAllowed
method in core
. When it's executed, values set via tagsItems
are validated by checking if they exist in list = self.opts('filterItems') || self._suggestions || []
array. Unfortunately, this array is empty and all tags are recognized as invalid, that's why they won't render.
Simple workaround: Just set filterItems
option to the same value as suggestions
like this:
$('#trades_textarea').textext({
plugins: 'autocomplete suggestions tags filter',
tagsItems: selectedTags,
filterItems: allTags,
suggestions: allTags
})
from jquery-textext.
@evereq This looks like a bug. Have you looked at the code? Any idea what's happening?
from jquery-textext.
@alexgorbatchev ah, no sorry - too busy with other things :)
from jquery-textext.
I observe this behavior as well. I can't initialize a textarea with tagsItems
together with the filter plugin.
from jquery-textext.
It occurred for me as well.
Here is sample code gist https://gist.github.com/2669286
I have removed "filter" plugin from it and It works.
@alexgorbatchev Great Work!
from jquery-textext.
I have the same problem. When you have filter and tags plugins, tagsItems and .addTags() don't work. I also tried using filter.enabled=false and then .addTags() without success.
@alexgorbatchev This js is cool. Thank you.
from jquery-textext.
Hello,
This works if you are using the suggestions plugin but if you are using ajax, you can not use this workaround. You have to call the ajax request "manually" to initialize the filterItems. And then I don't know what occurs if you add a new value into your backoffice? Will filterItems take it into account?
from jquery-textext.
I got around it by not using the built-in AJAX call function and instead, called the AJAX info into the page at the start on page load and then wrote it into the suggestions
option - not the most sophisticated solution but it was good enough for what I needed...
$.get('url_of_Ajax', function(data){ $('#id_selector').textext({ plugins: 'autocomplete filter tags suggestions', suggestions: data }); });
from jquery-textext.
Had the same problem, my solution was to edit the source code and change from
p.addTags = function(tags)
{
if(!tags || tags.length == 0)
return;
var self = this,
core = self.core(),
container = self.containerElement(),
i, tag
;
for(i = 0; i < tags.length; i++)
{
tag = tags[i];
if(tag && self.isTagAllowed(tag))
container.append(self.renderTag(tag));
}
self.updateFormCache();
core.getFormData();
core.invalidateBounds();
};
to
p.addTags = function(tags)
{
if(!tags || tags.length == 0)
return;
var self = this,
core = self.core(),
container = self.containerElement(),
i, tag
;
for(i = 0; i < tags.length; i++)
{
tag = tags[i];
if(tag)
container.append(self.renderTag(tag));
}
self.updateFormCache();
core.getFormData();
core.invalidateBounds();
};
Allowance in addTags I think it's not so usefull. Works like a charm :)
from jquery-textext.
kdzwinel, the workaround seems clean. Have you got any idea on how to load the item list with AJAX ?
from jquery-textext.
@alariva Sorry, I haven't worked with this plugin since my last comment - I don't remember the details.
from jquery-textext.
raduamarie, thanks!
but this code needed to be commited to the code.
from jquery-textext.
@eek can you please raise pull request, I think after that author can merge that into core, BTW nice work thanks your code works :)
from jquery-textext.
Done @fernao & @DhavalTailored but I don't think this plugin is maintained any more, we should ask for commit privileges or continue with a fork.
And maybe some design improvements (like Facebook has) and a React version which I can do and also a Vanilla JS one (jQuery is in decline from my point of view).
from jquery-textext.
Related Issues (20)
- Line-height issue
- How to validate empty textbox with jquery validate method
- Tags: input value is deleted when Enter is pressed, not when tag is added HOT 1
- Install
- Validate on blur HOT 2
- Initialization issue HOT 2
- outerHeight and outerWidth need to be updated
- Endless ajax-requests after focus HOT 1
- Same option can select again
- destroy
- Better integration with bootstrap style HOT 3
- taking too time to show suggestion autocomplete and sometime browser also hanged HOT 1
- show suggestion when textbox is focused.
- 绑定id和name,显示的是name,如何在标签完成后,就马上获得id
- 如何获取标签的回车事件
- How can I limit character lenght for AJAX call?
- Add a tag of subset of the Autocomplete suggestion word.
- Tagging some parts of a text
- Width not calculated correctly HOT 1
- About update 2.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-textext.