What is the best way to create a feature in Vue that filters options in real-time as we type into a

In my Vue application, I am trying to implement dynamic filtering for the options in a search box as the user types. Currently, the search box displays the entire list of options without any filtering happening even when the user is typing.

<el-form-item label="Filename" required>
              <el-select
                v-model="queryform.fileUuid"
                :remote-method="getFilenames"
                :loading="loading"
                filterable
                remote
                reserve-keyword
              >
                <el-option
                  v-for="(item, idx) in filenameOptions"
                  :key="idx"
                  :label="item.filename"
                  :value="item.uuid"
                />
              </el-select>
            </el-form-item>

The objects in the filenameOptions array have the following structure:

{ "filename" : "foo", "uuid" : "bar" }

In another block of code that follows a similar logic, everything works correctly:

              <el-select
                v-model="form.project"
                :remote-method="getProjects"
                :loading="loading"
                filterable
                remote
                reserve-keyword
              >
                <el-option
                  v-for="(item, idx) in projectOptions"
                  :key="idx"
                  :label="item.key"
                  :value="item.key"
                />

I'm currently facing an issue with the first block of code and I'm not sure why it's failing. Any suggestions or insights would be highly appreciated.

Answer №1

Is your implementation of the getFilenames method similar to the example shown on the documentation for remote search at this link? Make sure that you have a valid filter function since you are using the :remote-method attribute on the el-select element.

If you only want to filter option labels based on user input in the select element, consider using the cleaner approach described in the options filtering select element.

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

Creating React components through the use of the map function

Utilizing the hackernews api, I am attempting to extract the "data" property from my response object in order to display each story title individually on the browser. Initially, the data is structured as an array of id's representing individual storie ...

Obtain data in JSON format through an xmlhttp request

I originally used jQuery for this task, but I now want to switch to regular JavaScript as I'll be incorporating it into phonegap. I aim to avoid relying on different JS frameworks every time I make a server request, which could potentially improve per ...

Is it possible to duplicate this jQuery/Javascript feature using PHP?

I have the code to fetch tweets in JavaScript, but I need it converted to PHP. Can anyone provide any guidance on how to achieve this? $(document).ready( function() { var url = "http://twitter.com/status/user_timeline/joebloggs.json?count=1 ...

Avoid an excessive number of XHR/AJAX requests when using the Facebook embedded iframe

I am facing an issue with a Bootstrap Carousel that contains multiple social embeds from Facebook, all of which have videos. The problem is evident on this simple jsfiddle due to the Facebook embed. If you visit this page: https://jsfiddle.net/1L95vqn4/, ...

Is there a way to efficiently return an array of object and nested object keys with their full paths through recursion

My grasp of JS is still in its early stages, so understanding how the stack and recursion function can be challenging for me at this point. The task at hand involves displaying an array of object keys, including the parent object name if the object is nest ...

How can I make a div or iframe stretch to fill the remaining space using javascript, jQuery, or css?

I'm looking for a way to make the middle iframe dynamically fill the remaining space between two fixed height iframes (one at the top and one at the bottom) regardless of the window screen size. Is there a technique or method that can achieve this? th ...

How to Use AJAX, jQuery, and JSON to Send an Array to PHP

I'm attempting to send an associative array through AJAX $.post to a PHP script. Below is the code I am using: var request = { action: "add", requestor: req_id, ... } var reqDetails = $("#request_details").val(); ...

Positioning a Material UI Menu item underneath its parent element using CSS styling

I have created a Material UI dialog that features some text and an Icon with a dropdown menu option. You can check out the demo here: https://codesandbox.io/s/prod-rain-1rwhf?file=/src/App.js My goal is to properly position the Menu component so that it a ...

Utilizing Async / Await in the created lifecycle hook - Vue2

I recently installed the vue-element-loading package and added its component to my page.vue: <vue-element-loading :active="isActive" :is-full-screen="true"/> After adding a variable to my data: data () { return { isActive: false, } } I th ...

Smooth-scroll plugin does not activate active state (due to JS modification)

I'm currently facing an issue with a script that handles smooth scrolling and the active state on my main navigation. The plugin in question can be found at: It's important to note that the navigation bar is fixed and therefore has no height. T ...

Does the Loopback Model have an "exists" method that includes a where clause?

I am interested in querying the data using filters to check for existence. Does loopback support this method of querying? If so, could you provide some guidance? myModel.exists({where: {and: [{city: "London"}, {gender: "F"}]}}, function(err, bool){ if(bo ...

Angular: the uncertain numeral formatter

Looking to customize the behavior of the Angular number filter? Want it to leave the input unchanged if it's not a number? <my-tag input-value="{{foo() | number: 2}}"></my-tag> If foo() outputs 1.2345, display 1.23, but if it's "abc ...

Tips for dynamically assigning unique IDs to HTML form elements created within a JavaScript loop

let count = 0; while (count < 4) { $('#container').append("<div><input type='textbox' class ='left' id='left-${count}'/><input type='textbox' class ='right' id=' ...

Navigating to a new URL using window.location.href will seamlessly embed the new page within

I am new to JavaScript and I am facing an issue with my AJAX function. The function is supposed to navigate to a new URL, but instead of loading the new page separately as if the user had typed the URL, it gets inserted inside the same div where the button ...

Loading images dynamically in ReactJS allows for a seamless and customized user experience

I've been trying to dynamically fetch images from my images folder based on data retrieved from the database. Despite searching through numerous resources, I'm still struggling to crack this issue. Check out my code snippet below: import sword fr ...

Node-express can seamlessly switch between multiple databases dynamically

After extensive searching for a solution to my problem, I have come up empty-handed. If anyone has experience in similar situations, your help would be greatly appreciated. I have developed an application server in Node Express with MySQL as the database. ...

Integrating SignalR with Vue and Vuex for Real-Time Communication

I have been attempting to establish a connection between a SignalR hub and a Vue component, but so far I have not been successful. I have searched extensively for solutions by googling "vue with signalr" and reading through numerous links, even going as fa ...

Setting formData for a boolean in an Axios post request: a step-by-step guide

I am having trouble sending a post request using axios to my backend. It seems that I cannot include the boolean value "isActive" in the request. Is there a solution to this issue? async submit() { const isValid = await this.$validator.validateAll() ...

AngularJS - Sending configuration values to a directive

I'm trying to figure out how to pass parameters (values and functions) to an Angular directive. It seems like there should be a way to do this in Angular, but I haven't been able to locate the necessary information. Perhaps I'm not using th ...

Subdomain for an Ajax request

Can we use ajax requests to extract data from and fetch information from pages like ? It appears that JavaScript still does not permit subdomain requests. ...