Apr 12, 2021, 1:05 PM
[OPEN] [#1856] [Tagfield component] Data values disappearing after mouse select
Hi,
I am using the tagfield component on my project to select a list of countries and save them on my database.
However, I have noticed the following behaviour whenever I select a new country:
For example:
If my tagfield already has "Spain" in the selected items, and I select a new country "France" and check for the values with App.CountriesField.getValue():
I found that the behaviour described on my second point also happens on the first example you provide in https://examples5.ext.net/Examples/F...=1575504000440.
In addition, as I was checking for a possible solution, I've added two new listeners for the following events: "BeforeSelect" and "BeforeDeselect" to check what my values were. However, whenever I select a new country, both this events are fired multiple times. I wonder if these two issues could be related at all. For the second problem, I know there is already an open thread https://forums.ext.net/showthread.php?57551. For the first one, I've found nothing.
Is there any solution or a work around for these two problems?
I am using the tagfield component on my project to select a list of countries and save them on my database.
Html.X().TagField()
.ID("CountriesField")
.FieldLabel("Countries")
.LabelAlign(LabelAlign.Right)
.ForceSelection(true)
.Editable(true)
.Listeners(l => {
l.BeforeSelect.Fn = "onCountriesSelect"; // Currently, this function does nothing
l.BeforeDeselect.Fn = "onCountriesDeselect"; // Currently, this function does nothing
})
.InputMoving(true)
.CreateNewOnEnter(false)
.EmptyText("Select at least one country")
.Items(ViewBag.Countries as string[]) // All the countries
.SelectedItems(ViewBag.SelectedCountries as string[]) // All the selected countries
However, I have noticed the following behaviour whenever I select a new country:
- If I select it with the keyboard, everything works as expected and the new country is added to the selected items.
- If I type something to filter my list of countries and then select it with the mouse, then the tagfield behaves in a strange way and only saves the last country that I selected, erasing all the other previously selected countries. Note: I've noticed that this happens only if I type something to filter my list of countries.
For example:
If my tagfield already has "Spain" in the selected items, and I select a new country "France" and check for the values with App.CountriesField.getValue():
- In the first case, it will return ["Spain", "France"].
- In the second case, it will return only ["France"].
I found that the behaviour described on my second point also happens on the first example you provide in https://examples5.ext.net/Examples/F...=1575504000440.
In addition, as I was checking for a possible solution, I've added two new listeners for the following events: "BeforeSelect" and "BeforeDeselect" to check what my values were. However, whenever I select a new country, both this events are fired multiple times. I wonder if these two issues could be related at all. For the second problem, I know there is already an open thread https://forums.ext.net/showthread.php?57551. For the first one, I've found nothing.
Is there any solution or a work around for these two problems?