Polymer Integrated Binding for Advanced Search Options

Here is my code snippet to bind a tree in the Office->Team->"user" hierarchy. The main requirement is to enable user search functionality.

To bind the tree, I have processed the users array to fit the required hierarchy. For searching, I filter out the users not in the users array and rebuild the tree. Initially, the search operation works fine. However, after entering the next character, the users list is not being excluded from the tree. The generateTree contains valid data when the next character is entered.

I suspect that Polymer is not performing dirty checking until the array is empty. Since the binding needs to be done in the Users Array, which is within the Teams Array, that is within the Offices Array. Any help in resolving this issue would be appreciated.

<template id="template" is="dom-repeat" items="{{generateTree}}" as="offices" id="user-level1-items">

            <paper-submenu id="user-level1"  SearchEnabled="{{search}}" class$="{{search}}">
                <paper-item class="menu-trigger menu-level-1">
                    <iron-icon class$="{{offices.icon}}" icon="{{offices.icon}}"></iron-icon>
                    <span>{{offices.name}}</span></paper-item>
                <paper-menu class="menu-content">
                    <template is="dom-repeat" items="{{offices.Teams}}" as="Teams" id="user-level2-items">

                        <paper-submenu id="user-level2"  opened="{{Teams.open}}">
                            <paper-item class="menu-trigger menu-level-2">
                                <iron-icon class$="{{Teams.icon}}" icon="{{Teams.icon}}"></iron-icon>
                                <span>{{Teams.name}}</span>
                            </paper-item>
                            <paper-menu class="menu-content" id="user-level3">
                                <template is="dom-repeat" items="{{Teams.Users}}" as="Users">

                                    <paper-item " value$="{{Users._id}}"
                                    class="menu-level-3">
                                        <abc>{{Users.fullname}}</abc>
                                    </paper-item>

                                </template>
                            </paper-menu>
                        </paper-submenu>

                    </template>
                </paper-menu>
            </paper-submenu>

        </template>


Polymer({
    is: 'sa-org-tree-dynamic',


    properties: {
      level: {
        type: Number,
        value: 0
      }
    },

    inputData:function(){


        this.notifyPath('this.generateTree.teams.0.Users.*');



    }


    ready: function() {


    }

  });

this.generatetree is obtained from the parent element.

Answer №1

Utilizing JSON.parse(JSON.stringify(generateTree))
is effective in this case due to the fact that the array push and splice operations are not aligned with polymer standards.

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

Exploring the @HostBinding argument in Angular directives

Need help grasping the concept behind the @Hostbinding argument: Snippet of the code: import { Directive, HostBinding } from "@angular/core"; @Directive({ selector: '[appDropdown]' }) export class DropdownDirective { @HostBinding(&apos ...

Creating a CSS circle spinner with a half moon shape is an innovative way to add a unique touch

Image: Circular spinner rotating along the border rim of other solid circle For more details, please visit: https://codepen.io/sadashivjp/pen/oqqzwg I have created a UI codepen here and welcome any modifications or solutions. The code snippet is provided ...

Guide on utilizing JavaScript to modify the attribute of a chosen web element with Selenium WebDriver in Java

I am seeking a way to utilize Javascript in order to set attributes for the selected element on a webpage. After some research, I have discovered two methods for achieving this with Javascript: Method 1 WebDriver driver; // Assigned elsewhere Jav ...

Gulp: executing a task with no specified output location

I am attempting to create a straightforward task to display the file size for each file in an array of paths using the gulp-size plugin, as shown below: var gulp = require('gulp') var size = require('gulp-size') gulp.task('size&a ...

"Utilizing Node.js to access modules with their absolute

My directory structure is as follows: -- app/ |- models/ |- user.js |- config.json I am trying to make my user.js file require the config.json. Currently, I am using require('/config') but it doesn't seem to be working. Can som ...

How to dynamically reference an input textbox ID using javascript or jquery

I have a button titled: GridView1__ctl2_AddButton0 While I can extract the middle part "ctl2" (and variations for each row), I am trying to use it to populate a textbox among many with similar names. GridView1__ctl2_txtStormTimeOn Currently, I could ac ...

Filter an object in Typescript and retrieve a single key

Managing a set of checkboxes is essential in assigning roles to new users. While it's possible to filter and retrieve only the checked checkboxes, extracting just the "name" key poses a challenge. The current method involves filtering with a for loop ...

Configuring Proxy Settings for WebpackDevServer

I need assistance setting up a proxy using WebpackDevServer in my React/Node chrome extension. Currently, my server is running on localhost:4000, and the React frontend is on localhost:5000. When trying to access the route /api/user/ticket using Axios, I ...

AngularJS is not responding to a 400 bad request

Despite my efforts to find solutions on Google and Stack Overflow for similar or identical issues, as a newcomer, none of them have provided me with any insight on how to resolve the issues in my code. Here is the script I am working with: $http.post(&ap ...

Javascript - Execute function after all nested forEach loops have finished running

I'm finding this task to be quite challenging, as I am struggling to comprehend it fully at the moment. The issue involves nested forEach loops, and I require a callback function to execute once all the loops have finished running. I am considering u ...

"Exploring the concept of Undefined in Javascript Arrays

I keep encountering the issue links[i] is undefined. Even after explicitly defining it, the error persists. Any thoughts on why this might be happening? I am attempting to implement unobtrusive image rollovers for 5 links that I currently have. function ...

Deciphering JavaScript's Minus Equals Operator: What's the Significance?

Can you explain the significance of the minus equals symbol -= in the following code snippet? $('#wrapper').animate({ backgroundPosition: '-=2px' })(); Appreciate your help! ...

Combine the selected values of two dropdowns and display the result in an input field using Angular

I am working on a component that consists of 2 dropdowns. Below is the HTML code snippet for this component: <div class="form-group"> <label>{{l("RoomType")}}</label> <p-dropdown [disabled] = "!roomTypes.length" [options]= ...

Inserting multiple rows of data into a MySQL database in a single page using only one query in PHP

This snippet shows a MySQL query being used to update and insert data into a database: if ($_POST["ok"] == "OK") { $updateSQL = sprintf("UPDATE attend SET at_status=%s, at_remarks=%s WHERE at_tt_idx=%s", GetSQLValueString ...

The drop-down menu keeps flickering instead of remaining open when clicked

I am facing an issue with a dropdown menu in my webpage. The menu is initially hidden, but should become visible when the list element containing it is clicked. I have written JavaScript code to add a class that changes the visibility property to visible u ...

How do I insert a new item into the tree structure using Sapui5 CustomTreeItem?

Having an issue with the CustomTreeItem in SAPUI5. I can successfully display the tree structure from JSON, but struggling to manually add data on click of the Add button. https://i.sstatic.net/BpLOK.png In the image above, when I click the + Button, I n ...

Is it possible to create a pie chart using Chart.js with data fetched through an Ajax HTTP GET

Embarking on a new journey here, this week's focus is on delving into Chartjs for canvas and brushing up on JSON usage. The task at hand includes employing an Ajax HTTP GET request to fetch the json file. However, I am currently stumped on how to trig ...

When attempting to access /test.html, Node.js server returns a "Cannot GET"

Embarking on the journey of diving into Pro AngularJS, I have reached a point where setting up the development environment is crucial. This involves creating an 'angularjs' directory and placing a 'test.html' file in it. Additionally, o ...

Looking for assistance in transferring information from one webpage to another dynamic webpage

I'm in the process of building a website to feature products using NextJs. My goal is to transfer data from one page to another dynamic page. The data I am working with consists of a json array of objects stored in a data folder within the project. Wh ...

Node scripts and node bins are causing errors in Vue.js when running npm

While attempting to run my Vue project with the command npm run serve I encountered an error message that read: [email protected] serve /home/numan/Desktop/vue-getting-started/07-accessing-data/begin/vue-heroes vue-cli-service serve sh: 1: vue- ...