CreativeBulma / bulma-tagsinput

Bulma's extension providing user interface to manage tags supporting autocomplete.
MIT License
62 stars 21 forks source link

[Bug] Pre-set object tags with dynamic data source for changes #31

Open AaronMLB opened 2 years ago

AaronMLB commented 2 years ago

Using a dynamic data source works very well for initial input for tags on a form for adding a new record.

However, on an edit form where I have some previously entered tags to set up, new tags can not be added using the same XHR data source.

This may be related to the noted warning that

It is not possible to add tag by typing in this mode (only programmatically or using providing a data source).

I am able to type into the form, and suggestions are returned and returned correctly, but nothing happens when I click on one in the dropdown. Neither before.add nor after.add fire. The suggest dropdown simply closes.

It really should do something equivalent to the following:

inputTags.BulmaTagsInput().add([{
     option.itemValue: item.id,
     option.itemText: item.text
}]);
AaronMLB commented 2 years ago

I've explored this further and realised I misdiagnosed the problem somewhat.

What actually appears to be happening is that bulma-tagsinput objects to an itemValue that is a single digit, i.e. 1 - 9.

Could you offer any advice please @CreativeBulma? Is the component still being supported or in any way in active development?

AaronMLB commented 2 years ago

Okay, turns out the minChars option is at fault. It runs on the itemValue in object mode, not itemText as would be expected (and indeed implied by the docs).