Tagify select all?

Is there a way to create an option in the Tagify that if selected would add all of the fields in the dropdown list automatically?

I am listing a School list that has about 30 different schools. I want to make a fast selection option if they want to choose them all. I wasn’t able to see an option in the properties to customize this.

let me know if this is an option.

Tagify will use a source for the options and you will have selected a property for the value. When the user clicks a button, use the dynamic click attribute to addTags to the Tagify input, select the source data using the values formatter to get just the data for the field used for the Tagify values

i understand, but i was hoping there was a way for the user to easily select all of the options in the source to add it to the Tagify input without having to individually click on each one.

You can do it with a button.

  <button id="btn1" class="btn btn-primary" dmx-on:click="tagify1.addTags(serverconnect1.data.query.values(`category_id`))">Add All</button>
 <input is="dmx-tagify" id="tagify1" name="tagify1" dmx-bind:data="serverconnect1.data.query" tag-text="category" tag-value="category_id">
2 Likes

Excellent - Thank you for this. works perfectly!

okay, i am still having a slight issue with the Tagify.

I have a field that allows for a multiple select of a list.
When i put the option of the Tagify to a Select, the query is able to run without a problem

Now, when i change that last tagify to a Default option, which allows me to choose multiple options, i get an error when the query runs

the only thing i changed, is from Select to Default on the Tagify input on the last one here.

Any reason why this would be occuring?

When using multiple values with tagify, it sends an array value to the server action. So you need to adjust your query filter accordingly.

i have setup my Input post on the server side 2 different ways
First, i tried to setup the Custom query and split the fields

then i tried to change the post input to an Array and use that, it still produced the error.

Should i do something specific?

Split expects a string, not an array. The value returned by tagify is already an array.
Also why are you using the custom query for such a standard db query and not the query builder?

i am actually using a more complex query, but to try to debug this issue, i removed everything but the input i am having problems with to get this to work.

So, i have the input selected as a Text on the post variables

and i have Split String in the query…shouldn’t that work properly?

What you have selected there doesn’t change the output, it only gives info about the data type to the data pickers. The output coming from the component is an array.

no, as the value is already an array. You don’t need the split, as split is only used to split strings into arrays.

so, just testing this a little further…it does seem like its an issue with only the Custom Query.

I went ahead and removed the Custom Query and just setup a standard query with the same parameters, and it runs successfully


when i create a custom Query with the same setup, it runs the error.



is there no option to do an IN statement in the custom query?

With the custom query you can only create static queries, that means you can’t have a part that needs to add a dynamic number of parameters.

For example I have an array of 3 ids and want to select these 3 ids:

SELECT * FROM table WHERE id IN (:P1)

:P1 has the array with ids as value, this will not work, to make it work you need to know the number of parameters you are using.

SELECT * FROM table WHERE id IN (:P1, :P2, :P3)

When each id is put in its own parameter it works, but this only is usable when you know the number of parameters to expect.

So why does it work with the query builder? This is because the query builder builds its query dynamically, it generates the correct sql needed depending on the number of items in the array.

This discussion might be of interest.

Thank you TomD, i will try the find_in_set function and see if that displays the results correctly.

I am still working with the Tagify and i have an Add All option that adds all of the selections to the query…buy question is, is there a way to ‘show’ the spinning border while the Tagify is adding those values to the text field?

I tried to use the server executing option, but that only activates when the page loads. It doesn’t seem to affect when the query is run in the tagify button.

<button id="btn3" class="btn btn-sm mt-1 mb-1" dmx-on:click="referral_providers.addTags(sc_referral_providers.data.referral_providers.values(name))">Add All<span class="spinner-border spinner-border-sm" role="status" dmx-show="sc_referral_providers.state.executing"></span> </button>

The server action is not running again when you run this action on click. This server action is already on the page and loaded, the data is already available for all the components and it doesn’t run.

so, there is no way to show a spinner when the Add Tags function is running on this? Some of the add functions to add on these take a few seconds, so i just wanted to show activity.