Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't call plugin methods or maybe just documentation issue #6

Closed
evereq opened this issue Jan 11, 2012 · 7 comments
Closed

Can't call plugin methods or maybe just documentation issue #6

evereq opened this issue Jan 11, 2012 · 7 comments
Assignees
Milestone

Comments

@evereq
Copy link

evereq commented Jan 11, 2012

Perfect code, excellent documentation & cool examples...
However I can't found what I need :( for some reason.
All I need is to simply add few tags using Javascript into already created input element, not during initialization (using perfect declarative way which shown 1000s times in docs / examples)
I.e. I go over all docs, but seems can't found the way how to invoke textext plugin methods!
For example, if I need to call some methods in 'ItemManager' (http://textextjs.com/manual/itemmanager.html), I can easy do something like (the bad thing that no such examples at all in the docs):

  var textext = $('#keywords').textext()[0];
  var item =  textext.itemManager().stringToItem('cool');

However, when I tried to call something like:

  var textext = $('#keywords').textext()[0];
  var item =  textext.tags().addTags(['hello','shit']);

It just fails....

The same happens with:

  var textext = $('#keywords').textext()[0];
  var item =  textext.TextExtTags.addTags(['hello','shit']);

etc.

I.e. seems can't found any "easy" way to call dirrectly plugin methods??? Strange.. because I think every such library should have at least methods which are easy accessible and documented well, like $('#keywords').textext()[0].addTags('hello','shit') or var tags = $('#keywords').textext()[0].getTags() etc.

Am I miss something?

Big thanks!

@evereq
Copy link
Author

evereq commented Jan 12, 2012

Any news? Because right now it just drive me crazy :D To get tags that was entered, I issue following undocumented code (founded reviewing SOURCE HTML of the following page http://textextjs.com/manual/examples/tags.html ...):
var textext = $('#keywords').textext()[0];
var tags = textext.hiddenInput().val();
Should be some easy / well documented way to get entered tags, what you think??? :)

@seanodotcom
Copy link

+1
Simple question: How do you add TextExt tags programmatically?

On http://textextjs.com/manual/examples/tags.html I see an addTags(tags) method... but can't find the pointer to call it correctly.

@ghost ghost assigned alexgorbatchev Jan 14, 2012
@alexgorbatchev
Copy link
Owner

@seanodotcom @evereq Thanks for feedback, I released "emergency" 1.2.0 which just includes this feature, please see the demo

http://textextjs.com/manual/examples/tags-adding.html

@evereq
Copy link
Author

evereq commented Jan 15, 2012

excellent and quick! Thanks! :)

@evereq
Copy link
Author

evereq commented Jan 15, 2012

Side note: if you select order of plugins for example like "plugins: 'prompt focus autocomplete arrow tags'" than yes, feature works. However if you use order like 'tags prompt focus autocomplete arrow' new feature do NOT work for some reason :) Spend few minutes today to figure out this :D Seems you may need to fix it in next version ;-)

@sirvine
Copy link

sirvine commented Feb 12, 2012

I used this to add any text remaining in the input as a tag upon form submission (something I think is expected behavior for tag inputs, by the way).

I can confirm evereq's issues as well: the feature will expect 'tags' to be the last plugin specified in the options parameters. Otherwise, it will select whichever plugin is last instead.

   $('#form_element').submit(function(){
      var input_element = $('.textext-input-element');
      input_element.textext()[0].tags().addTags([ input_element.val() ]);
      input_element.val("");
   });

@rodrigosilveirafa
Copy link

Hi evereq!
Try it:
$('#keywords').textext()[0].tags().addTags([ { name: 'Hello', id: '1' },{ name: 'Shit', id: '2' } ]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants