AngularJS - Issue with re-displaying original data after clicking a link

I have set up a Plunker to demonstrate the issue here

When you click on the "Display rows with missing data" link, it correctly filters to show rows with missing data. However, if you then click on "show all data," the rest of the data does not reappear. How can this issue be resolved?

Code:

vm.applyMissingValuesFilter = function (linktext) {

       if (linktext === "Display rows with missing data") {

           vm.savedResourceGridResources = vm.resourceGridResources;

           var results = [];

           var temp = vm.resourceGridResources.Resources;

           for (var i = 0; i < temp.length; i++) {
                  for (var j = 0; j < temp[i].Resources.length; j++) {
                      if (!temp[i].Resources[j].Value) {

                          if (results.indexOf(temp[i]) === -1) {
                              results.push(temp[i]);
                          }
                      }
                  }
              }

          vm.resourceGridResources.Resources = results;

          vm.missingValuesButtonText = "Show all data";
      }
      else if (linktext === "Show all data") {

          // should reset the resource values here to redisplay original data?
          vm.resourceGridResources = vm.savedResourceGridResources;

          vm.missingValuesButtonText = "Display rows with missing data";

      }
};

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

Updating MongoDB with an unknown object can be a challenging task, but there

In my current project, I have set up a Mongoose model as follows: const userSchema = new mongoose.Schema({ userID: { type: String, require: true, unique: true }, username: { type: String }, serverID: { type: String, require: true }, roles: ...

Is it possible for me to scrape an HTML code snippet directly from a browser?

How can I extract specific content from an HTML code block using only JS or jQuery on a browser? Below is the code I am working with: <ul> <li>New York</li> <li>London</li> <li>Madrid</li> <li&g ...

Misunderstandings between HTML and CSS

Can someone please clarify how the functionality of the active-slide class? Code: <div class="slider"> <div class="slide active-slide">..</div> <div class = "slide slide-feature">..</div> <div class = "slide">..</di ...

Error message: Unable to access .exe file through HTML link

We have a need to include an HTML link on our intranet site that, when clicked, will open an .exe file that is already installed on all user machines. I attempted the following code: <a href = "C:\Program Files\Cisco Systems\VPN&bsol ...

Efficiently sift through a vast assortment using a filtering method

Currently, I am developing an application similar to Uber which involves managing a collection of drivers with their current positions (latitude and longitude). One specific requirement is to find drivers who are within a 200-meter distance from the user& ...

Move the Vite build files to a different directory post-build

I currently have multiple Vue projects alongside a Wordpress project. One of the Vue projects is built with Webpack, while the other one is built with Vite. The folder structure is as follows: project | |__vue-project-webpack | | | |__dist | ...

Is there a way to update a single element within an array without triggering a refresh of the entire array?

Is there a way to prevent the component from rerendering every time new data is input? I attempted to memoize each cell but I am still facing the same issue. Any suggestions on how to accomplish this? import React, { useState, memo } from "react&quo ...

Is it possible for invoking a web service recursively in JavaScript to lead to a stack overflow issue

I am currently working on a migration procedure that may last between 2 to 3 days to complete. My concern is that the implementation I have in place could potentially result in a StackOverflow exception due to its recursive nature. I am questioning wheth ...

"Escaping from the typeahead feature in Angular-UI Bootstrap results in the input field value becoming

Having some difficulty solving a particular edge case scenario. When I select a value from the dropdown of the typeahead using either the keyboard or mouse, the ng-model in the input field is populated correctly. However, if I type a few letters and then ...

Transmit an array in a post request with Node.js using the application/x-www-form-urlencoded content type

After attempting to send a post request to an API with post parameters as an array, I encountered difficulties. Here is how it can be done using cURL: curl http://localhost:3000/check_amounts -d amounts[]=15 \ -d amounts[]=30 I then tried to ach ...

Does Mongoose use asynchronous saving?

Just starting out with mongoose and node. I'm trying to determine if the mongoose document.save method is asynchronous. Based on my observations, it seems to work even when not connected. Is there any way to know for sure when the document has been s ...

Utilizing AngularJS with an extensive collection of JSON data

Currently, I am working on developing an application that utilizes a Parent-Child hierarchy by incorporating AngularJs to connect the information retrieved from the RESTFUL web service with the user interface. To demonstrate, here is an example of the JSO ...

find all occurrences except for the last of a pattern in javascript

When considering the patterns below: "profile[foreclosure_defenses_attributes][0][some_text]" "something[something_else_attributes][0][hello_attributes][0][other_stuff]" It is possible to extract the last part by utilizing non-capturing groups: var rege ...

Tips for displaying nested components in React

I am currently facing a challenge involving rendering different database tables as HTML tables in React. The issue at hand is that each table has a different number of columns. In my component, I receive header data along with the full table data in JSON f ...

"Looking to retrieve data from an array instead of an object in JavaScript? Here's how you can

There is a slight issue with my fetch method in grabbing data from this link . I am attempting to use the .map function on it but instead of functioning properly, I encounter an error that says Unhandled Rejection (TypeError): jedis.map is not a function. ...

Angular: Tailored content and design for individual customers

Currently, I am in the process of creating a web application using Angular that will cater to various clients. Each client has their own unique requirements in terms of functionality and style. However, there are certain functionalities that are common acr ...

Implementing ID-based filtering for an array of objects with React

Struggling with filtering an object in an array of objects by its ID using React. Here's the scenario: The app is a Notes app that stores each note with its Title, Text, and created date, utilizing the ID as the key. Currently, I'm working on c ...

Controller encounters a error when requiring a module

Struggling to set up Stripe for my app, I've encountered some issues with the module implementation. Typically, I would require a module at the top of the file to use it. However, in the paymentCtrl file, when I do this, it doesn't work and I rec ...

Creating a nested observable in Angular2: A step-by-step guide

Currently, I am exploring a new approach in my Angular2 service that involves using observables. The data source for this service will initially be local storage and later updated when an HTTP call to a database returns. To achieve this dynamic updating of ...

Can a JavaScript or jQuery function be triggered on input change to perform a PHP call to check a database?

Is it possible to implement live form validation without a page reload? I am looking to add a function like the one below: <input onchange="validate();"></input> function validate() { // PHP here to check input value against table value o ...