Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9017913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:23:23+00:00 2026-06-16T04:23:23+00:00

I have an issue where I am searching on keyupdate on an observable array

  • 0

I have an issue where I am searching on keyupdate on an observable array and sometimes the page freezes. It happens when “indexOf” is inserted in the logic. I just want to hide the objects that are filtered out. It mainly happens when I go under 2 characters. There are 1500 rows. Another thing I noticed this only happens in Chrome, but in IE it works just fine quick!

JS

            var self = this,
                intervalId = null;

            self.powerSchoolCourses = ko.observableArray([]);

            // Stores The Text To Filter The Powerschool Course List
            self.powerSchoolCourseSearchText = ko.observable('');

            self.powerSchoolCourseSearchText.subscribe(function (searchText) {

                if (intervalId)
                    clearTimeout(intervalId);

                intervalId = setTimeout(function () {

                    var powerSchoolCourses = self.powerSchoolCourses();

                    ko.utils.arrayForEach(powerSchoolCourses, function(powerSchoolCourse) {

                        if (searchText.length < 3) {
                            powerSchoolCourse.visible(true);
                        } else if (powerSchoolCourse.courseName.toLowerCase().indexOf(searchText) == -1) {
                            powerSchoolCourse.visible(false);
                        } else {
                            powerSchoolCourse.visible(true);
                        }
                    });

                }, 300);
            });

UI

<div class="filter">
                                    <div class="input-prepend">            
                                        <span class="add-on"><i class="icon-search"></i></span>
                                        <input class="span2" type="text" placeholder="Powerschool Course Name" data-bind="value: powerSchoolCourseSearchText, valueUpdate: 'afterkeydown'" />                                         
                                    </div>
                                </div>

    <!-- ko foreach: powerSchoolCourses -->
                                    <div class="ps-course" data-bind="draggableCourse: {}, css: { 'even-row': $index()%2 }, visible: visible()">
                                        <span class="icon-move"></span>
                                        <span data-bind="html: courseName"></span> (<span data-bind="html: courseNumber"></span>)

                                        <!-- ko foreach: brainHoneyTypesSorted -->
                                        <span class="badge" data-bind="html: $data[0]"></span>
                                        <!-- /ko -->

                                        <a class="icon-plus" data-bind="click: $root.showSections.bind($data), attr: { title: showSections() ? 'Hide Sections' : 'Show Sections' }, css: { 'icon-minus': showSections() }"></a>
                                    </div>

                                    <div class="sections" data-bind="visible: showSections()">
                                        <div class="header">
                                            <!-- ko if: loadingSections() -->
                                            Loading Sections...
                                            <!-- /ko -->
                                            <!-- ko if: !loadingSections() && sections().length == 0 -->
                                            No Sections Found
                                            <!-- /ko -->
                                            <!-- ko if: !loadingSections() && sections().length > 0 -->
                                            Sections
                                            <!-- /ko -->
                                        </div>
                                        <div class="data">
                                            <!-- ko foreach: sections -->
                                            <div class="ps-section" data-bind="css: { 'even-row': $index()%2 }">
                                                <span data-bind="html: schoolName"></span>
                                                <span data-bind="html: teacherLastName"></span>
                                                <span data-bind="html: courseName"></span>
                                                <span data-bind="html: term"></span>
                                                <span data-bind="html: expression"></span>
                                                <span data-bind="html: bhType"></span>
                                            </div>
                                            <!-- /ko -->
                                        </div>
                                    </div>
                                    <!-- /ko -->
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:23:25+00:00Added an answer on June 16, 2026 at 4:23 am

    I updated the visible: visible() to if: visible(), and the problem is gone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After searching the other questions none have answered the specific issue I have. We
Recently I have encountered an issue with Scribd where searching via Scribd API (docs.search)
I have tried googling and searching for this issue on SO - but have
I have been searching for a solution for this issue for multiple hours today
I have tried searching the database for a similar issue, but was unsuccessful in
I'm searching for following issue i have. The class file names of our project
I have an issue getting data from three tables, which I want to return
I have been searching for a solution to this issue for a few days
I have issue with: <form:checkboxes path=roles cssClass=checkbox items=${roleSelections} /> If previous line is used
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.