Trouble getting search filter to function properly on an array of objects in a Vue JavaScript application

Can someone help me with integrating this code into my project? Here is the code I am referencing: http://jsfiddle.net/dkmmhf5y/701/

This snippet shows my JavaScript file, please disregard the 'test' data

var app = new Vue
  (
  {
    el: '#main',
    data: function ()
    {
      return {
        search: '',
        customers: [
          {
            id: 1,
            org: 'OOC',
            vendor: '1',
          },

          {
            id: 2,
            org: 'Golf 123Test',
            vendor: '@aboutTest',
          },

          {
            id: 3,
            org: 'AdvanceWaTest',
            vendor: '@actuTest',
          },

          {
            id: 4,
            org: 'Test4',
            vendor: 'Test3345',
          }

        ]
      };

    },

    computed:

    {
      filteredCustomers: function ()
      {
        var self = this;
        return this.customers.filter(function (cust)
        {
          return
          cust.vendor.toLowerCase().indexOf(self.search.toLowerCase()) >= 0;

        });
      }
    }


  }


  );

Below is a section of my HTML code from within the body of an HTML file. I have removed most of the unnecessary elements to focus on what's important:

    <!DOCTYPE html>
<html>

<head>
  <link rel="icon" href="langleylogo.png">
  <link href='style.css' rel='stylesheet' type='text/css'>
  <link href="https://fonts.googleapis.com/css?family=Quicksand" rel="stylesheet">
  <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN"
    crossorigin="anonymous">
  <meta charset="UTF-8">


  <title>Langley</title>


</head>




<body>



  <div id="main">
    <div class="parent">
      <div class="left">
        <div class="blueTop">
          <input type="text" v-model="search" class="orgSearch" placeholder="Client  |  ToDo  |  Ticket">
        </div>
        <div class="leftMiniContainer">


          <template v-for="customer in filteredCustomers">
            <div class="clientSearchCard">
              <div class="orgVendor">V:</div>
              <div class="clientSearchCardValue">{{ customer.vendor }}</div>
              <br>
              <div class="orgVendor">O:</div>
              <div class="clientSearchCardValue">{{ customer.org }}</div>
            </div>
          </template>
        </div>

      </div>



      <div class="right ">

        <div class="right-nav ">
          <a href="index.html " class="selected ">
            <i class="header-glyph fa fa-home " aria-hidden="true "></i> Overview
          </a>

          <a href="status.html ">
            <i class="header-glyph fa fa-check-square-o " aria-hidden="true "></i> Status
          </a>

          <a href="client.html ">
            <i class="header-glyph fa fa-address-card " aria-hidden="true "></i> Client
          </a>

          <a href="ticket.html ">
            <i class="header-glyph fa fa-ticket " aria-hidden="true "></i> Ticket
          </a>

          <a href="todo.html ">
            <i class="header-glyph fa fa-list " aria-hidden="true "></i> To Do
          </a>

          <a href="files.html ">
            <i class="header-glyph fa fa-file-image-o " aria-hidden="true "></i> Files
          </a>

          <a href="features.html ">
            <i class="header-glyph fa fa-wrench " aria-hidden="true "></i> Features
          </a>

          <div class="right-nav-config ">
            <a href="config.html ">
              <i class="fa fa-user-circle " aria-hidden="true "></i>
            </a>
          </div>


        </div>
        <div class="clientListWrapper ">

        </div>
      </div>


    </div>



  </div>




  <script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1066657550223e253e2127">[email protected]</a>/dist/vue.js"></script>
  <script src="app.js"></script>


</body>

</html>

I initially had success displaying the entire array of object data, but now I'm struggling to only show the data entered into the text box.

Answer №1

When you encounter a black in your JavaScript code, simply deleting it can resolve the issue and allow the code to function properly. Please refer to this image for a visual representation of the error: https://i.sstatic.net/tClzp.png

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

Sending an array of objects to a MySQL database using React and NodeJS: A comprehensive guide

As someone who is new to NodeJS and Mysql databases, I am currently working on a small React project that involves a week calendar for booking lessons. My main focus right now is creating an admin panel where teachers can set their availability throughout ...

Efficient Ways to Store Text and Images in Vue.js

I have developed a tool that enables users to upload an image and overlay custom text on it, which can be viewed and edited in the browser. My query is whether it is feasible to save the combined image and text as separate files (e.g., jpg/png) using VueJS ...

Exchange one HTML element with a different HTML element

I've been attempting to change an HTML tag using PHP or jQuery. The current default tag is: <li class="dropdown"> <a href="index.html" class="dropdown-toggle"> Home</a></li> My desired replacement for the above HTML tag is: ...

What is the best way to implement rate limiting or throttling on a Strapi API?

Our company relies on a simple strapi API implemented in node.js and hosted on Heroku. Despite our efforts, we have not been able to find a solution to implement rate limiting, as it appears that Heroku does not offer throttling add-ons and strapi lacks bu ...

Retrieve a single document using Angularfire2 without setting up a listener

I'm facing an issue with angularfire2 v6 and angular 11. Specifically, I am attempting to retrieve a single document from the users collection based on their email without utilizing valueChanges() or snapshotChanges(). Realtime updates are not necessa ...

What are the steps to incorporate PointerLockControl in Three.js?

Having trouble correctly integrating the PointerLockControl in Three.js? Despite trying various examples, errors seem to persist. I've been importing libraries through the head part like this: <script src="lib/controls/PointerLockControls.js"> ...

unable to access POST information

I have encountered an issue with getting a basic AJAX POST to function properly. After facing difficulties with using a jQuery .click, I switched to an onclick method. I am unsure if I am making a glaring mistake or if there could be an issue with Apache s ...

Preventing users from copying and pasting information from my form by implementing javascript restrictions

I'm looking for a solution to prevent users from copying and pasting in my form using JavaScript. I want to restrict the ability to paste or copy any content into the form. Any assistance would be greatly appreciated! ...

What is preventing me from merging these two arrays together?

Here is some code for a Vuex mutation: export const CREATE_PANORAMAS = (state, panoramas) => { console.log('building.panoramas:', state.building.panoramas) console.log('panoramas:', panoramas) state.building.panoramas.concat(p ...

Is it possible to designate a desktop PWA to remain "permanently on top" of all other applications?

Is it possible to keep a counter in Vuejs with PWA always on top for desktop? I have been researching this but haven't found any solutions yet. Thank you! For your information, the counter is based on a productivity method similar to Pomodoro, but w ...

Is there a way to decode/compile/interpret the data within nested HTML tags within my AngularJS directives?

How can I process/compile/resolve the contents of enclosed HTML in my directives. The specific directive being discussed is: angular.module('transclude', []) .directive('heading', function(){ return { restrict: 'E&apos ...

Issue with Angular application failing to fetch data from JSON server

I've been attempting to retrieve data from a local server, but so far I'm not getting any results. The concept is to have a service handle the retrieval process and return an observable for any components in need of the data to subscribe to. dis ...

Creating interactive HTML buttons using JavaScript to trigger AJAX requests

My current task involves populating an HTML table to showcase users. By making API calls to retrieve user data, I utilize Javascript to add rows to the table. Each row ends with a delete button, intended to trigger a $put request to a separate API endpoint ...

Double the fun: JavaScript array appears twice!

I am currently working on displaying the selected filters from checkboxes. Initially, I create an array containing the values selected from the checkboxes and then aim to add them to a string. Suppose I have two checkboxes labeled: label1 and label2, my a ...

Managing "unprocessed information" in a Node.js environment and transferring the information through a Node Express endpoint

Currently, I am in the process of making an API call to retrieve a file using axios: async function fetchData() { const configuration = {}; // { responseType: 'stream'}; const { response } = await axios.get(URL, configuration); c ...

What is the best way to share image data between pages in Next.js?

I'm currently developing a project that mimics Instagram (simply because I want to explore Next.js further) and I'm looking for a way to handle image uploads. My goal is to allow users to upload their images and then redirect them to the "create ...

Trouble with AngularJS Controller Displaying/Hiding Content as Expected

I'm struggling to make content disappear when a button is clicked and then show a new set of content upon that button click. I can't seem to get it to work as intended. The first section simply does not disappear when the button is clicked. The s ...

Fetching data from MongoDB, loading over 3000 entries and implementing pagination

I'm facing a challenge where I need to display more than 3000 results in an HTML table by fetching MachineID, Username, and Data from my MongoDB. However, I am encountering difficulties when trying to render this data using datatables. The MachineID ...

What is the best way to transfer all li elements with a certain CSS style to a different ul?

I have a task to relocate all the <li style="display:none;"> elements that are currently nested under the <ul id="bob"> into another <ul id="cat">. During this relocation process, it is important that all the classes, ids, and CSS style ...

AngularJS - Move the <li> element to the top when its corresponding checkbox is selected

This particular question pertains to a topic that was previously discussed in another thread The scenario involves using a ng-repeat as shown below: <li ng-repeat="opt in namesCtrl.uniqueCars"> <input type="checkbox" ng-model="namesCtrl.filt ...