Tips for successfully transferring data using a dynamic key in a Semantic UI Vue dropdown

My current challenge involves troubleshooting the semantic-ui-vue dropdown functionality.

To view the issue, visit my sandbox link: https://codesandbox.io/s/3qknm52pm5.

Within the sandbox environment, there are two dropdown menus labeled as From and To.

From correctly displays values while To does not due to a key mismatch.

The script in my App.vue file looks like this:

<script>
export default {
  data() {
    return {
      from: [],
      to: [],
      fromCollection: [
        {
          value: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b4a49486b4c464a424705484446">[email protected]</a>",
          text: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e8898a8ba88f85898184c68b8785">[email protected]</a>"
        },
        {
          value: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1e7a7b785e79737f7772307d7173">[email protected]</a>",
          text: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="86e2e3e0c6e1ebe7efeaa8e5e9eb">[email protected]</a>"
        },
        {
          value: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b9c8cedccbcdc0f9ded4d8d0d597dad6d4">[email protected]</a>",
          text: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfaea8baadaba69fb8b2beb6b3f1bcb0b2">[email protected]</a>"
        },
        {
          value: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a9dac1dccbc1c8c4e9cec4c8c0c587cac6c4">[email protected]</a>",
          text: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="37445f42555f565a77505a565e5b1954585a">[email protected]</a>"
        }
      ],
      toCollection: [
        {
          email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3b5a59587b5c565a525715585456">[email protected]</a>"
        },
        {
          email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1074757650777d71797c3e737f7d">[email protected]</a>"
        },
        {
          email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="82f3f5e7f0f6fbc2e5efe3ebeeace1edef">[email protected]</a>"
        },
        {
          email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="43302b36212b222e03242e222a2f6d202c2e">[email protected]</a>"
        }
      ]
    };
  }
};
</script>

I employed the following component for both dropdowns:

<sui-dropdown
      fluid
      multiple
      :options="fromCollection"
      placeholder="from"
      selection
      v-model="from"
      search
      :allowAdditions="true"
      text="email"
    />
<sui-dropdown
      fluid
      multiple
      :options="toCollection"
      placeholder="from"
      selection
      v-model="to"
      search
      :allowAdditions="true"
      text="email"
    />

The first dropdown correctly displays values because it is fetching data from fromCollection, whereas the second dropdown remains blank since it fetches data from toCollection with different key names.

If anyone has a solution or suggestions on how to pass data with dynamic keys similar to toCollection, please share your thoughts.

I have not found any relevant information in the official documentation. Looking forward to assistance!

Answer №1

Defining a field name for a dropdown is not possible in this scenario.

The only solution is to use computed properties to create a new array for the dropdown.

Check out the demo here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

There is no 'depto_modules.length' property in this row. How should I go about fixing this issue?

I have a table set up to display data from an associated table. The functionality is working fine, but I keep seeing a warning message when I apply certain filters: The warning states that the property depto_modules.length does not exist in the row. It ad ...

Encountering the "Vue warn: Error compiling template" issue in Laravel while utilizing the Dump function

I have a minor issue with my Blade template. When attempting to display the contents of a PHP array using dump(), I encounter an "Error compiling template" message from Vue. My Laravel version is 7.15. This problem persists even when I utilize the Blade di ...

Tips for transferring v-model to a child element along with the change event

In my Vue2 project with Vuetify, I am working on implementing filters to hide certain games when specific filters are turned off. Everything functions correctly until I attempt to move the filters into a separate component. The goal is to make these filt ...

Pressing the Enter key does not initiate a redirect on the page

Hey there! I've set up a text field where users need to input a password in order to download a PDF file. If the password is correct, they are directed to the URL of the PDF file. However, if the password is wrong, they are redirected to a page called ...

Accordion not appearing on the webpage

I'm currently working on implementing a helpful feature at the bottom of my webpage to assist users with navigation. I was thinking of using an accordion as a dropdown helper, but I've been facing some challenges getting it to function properly. ...

Obtain the response header variable within a Shiny application

In Apache, the LDAP login is passed to a variable called X-Remote-User in the header: I am unsure how to retrieve this information in my Shiny app. Does anyone have any ideas? Maybe using JavaScript could be a solution? ...

Customizing the styling of buttons in Highcharts is disabled when in full screen mode

I've integrated highcharts into my Angular application and included a custom button inside the chart to navigate users to another page. However, I encountered an issue when trying to fullscreen the chart using the export menu. The position of the cus ...

The JSON key has been labeled as "valid", making it difficult to access in JavaScript as demonstrated in a JSfiddle example

Initially, I transformed a Plist file (XML formatted) into JSON using an online tool. Extracting the important data from this extensive JSON file was not a challenge. Utilizing this crucial data, I am reconstructing a new JSON file that is concise and cont ...

Components in React are unable to be accessed

I'm a complete beginner when it comes to React and I'm facing issues with organizing my components into separate files. The error message I encounter is: ERROR in ./src/App.js 5:0-34 Module not found: Error: You attempted to import /components/ ...

Vuetify - What is the best way to include a 'Select' component inside a Header or text container?

As a backend developer diving into front-end work, please bear with me as I explore new territory. Picture a prominent header at the top of a web page: Displayed below is a list of available stock for ↓users-dropdown↓ By clicking on the ↓users-dro ...

How to toggle code block visibility in Angular's ngOnInit() method

I'm currently analyzing different design patterns to optimize the number of REST calls when implementing a 'save while typing feature'. To provide a general overview, in my ngOnInit() function, I have included the following code snippet (wit ...

Steps to creating a popup within an HTML page from another HTML page

I recently started learning JavaScript. I have a link on my homepage that directs to another HTML page, but I would like it to show as a popup on the homepage with responsiveness and some stylish design elements such as a folded corner. Is there a way to a ...

The process of implementing sticky headers that stay in place while scrolling in a React application

I have a challenge with organizing tables based on date, using headers like (today, yesterday, last week, ...) and I want to make them sticky depending on the current table in the viewport. I attempted to implement this functionality using the react-sticky ...

Transferring data between different elements in a React application

I am currently learning React and facing some challenges in terms of passing data between components. Even after reviewing various tutorials and blogs, I am still struggling to make things work. Within my project, I have two child components named Body-c ...

Javascript is handling the JSON Request flawlessly, however, when using Nodejs, an error is encountered with a status

I'm trying to fetch a simple JSON File in NodeJS. Using Javascript and jQuery, it functions perfectly: $(document).ready(function() { $.getJSON('https://www.younow.com/php/api/broadcast/info/curId=0/user=Peter', function(json) { if ...

What is an alternative way to replicate the functionality of jQuery's remove() method using only vanilla JavaScript?

Here is the line of code I have: $('.js-cover-menu-dropdown > li > ul').remove(); This code removes all ul elements from the lis within .js-cover-menu-dropdown. I am curious about how I could rewrite this using plain JavaScript. ...

Laravel implementation of Bootstrap Datepicker

Incorporating Laravel bootstrap and a date picker, I have encountered an issue where the todayHighlight feature is not functioning correctly. Additionally, the container aspect is also not working as intended. <link rel="stylesheet" href="https://sta ...

Passing parameters to an external function in order to display a message is proving difficult. An error of type TypeError is being encountered, specifying that the Class constructor AlertMessage cannot be called without using the

Every time I attempt to pass a message as an argument to the showAlert() function, an error is triggered: Error: An instance of the AlertMessage class cannot be created without using 'new' image: I am simply trying to send the message as a para ...

Using Jest: A guide to utilizing a mocked class instance

When working on my frontend React application, I decided to use the auth0-js library for authentication purposes. This library provides the WebAuth class which I utilize in my code by creating an instance like so: import { WebAuth } from 'auth0-js&ap ...

Animated Debugging with Node.js

Encountering an issue with code that runs smoothly on other devices but seems to be laptop-specific. Even a simple "hello world" application is only displaying a debug image instead of the expected output. repository folder> node app.js Express Server ...