Improve the loading speed of HTML Tables

I've encountered an issue with rendering tables in the UI.

The problem arises from the fact that the tables are being rendered based on a large list using ng-repeat, resulting in slow rendering times.

Below is the CSS code used:

table {
     width: 100%;
     table-layout: fixed;
     border-collapse: collapse;
     border-spacing: 0;
}
 .wrapper .table-nested {
     background: #fff;
     border: 2px solid #444;
     text-align: left;
}
 .wrapper .table-nested th, .table-nested td {
     padding: 0;
}
 .wrapper .table-nested th + th, .table-nested th + td, .table-nested td + th, .table-nested td + td {
     padding-left: 5px;
}
 and so on...

Additionally, here is the HTML code snippet for rendering the tables.

<div class=" wrapper">
    <p>Fields</p>
    <table class="table-nested">
        <thead>
            <tr>
                ...
            </tr>
        </thead>

        <tbody ng-class="{opened: item.opened}" ng-include="'table_tree.html'" ng-repeat="item in currentFile.xmlFileAttributes.addNewXmlFileFieldList.xsdElement"></tbody>
    </table>
    <script id="table_tree.html" type="text/ng-template">
        ...
</div>

I'm looking for advice on optimizing this setup. Should I modify the list structure or utilize JavaScript to enhance rendering speed?

Here is the relevant JS code:

$scope.toggleAllCheckboxes = function($event) {
    ...
};

$scope.initCheckbox = function(item, parentItem) {
    ...
};

$scope.toggleCheckbox = function(item, parentScope) {
    ...
};

 and so on...

Any suggestions or recommendations would be greatly appreciated.

Answer №1

After attempting the following solution:

tr class="children" ng-if="item.elements && item.elements.length > 0 && item.opened"

I am pleased to report that it was successful!

Grateful for the assistance!

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

Switching between multiple images using Jquery on a click event

Hi there, I am currently working on a project where I need to use jQuery to switch between three images when clicked. Once the third image is clicked, it should cycle back to the first picture. I was wondering if there is a way to modify the code below so ...

Best Practices for Utilizing Bootstrap 5 Tooltip and Popover Methods in AngularJS Web Applications

Our AngularJS 1.8.2 application requires an upgrade to Bootstrap 5 in order to properly support Tooltips, Popovers, and Modals. Previously, we had been utilizing ui-bootstrap for handling popups. However, migrating from ui-bootstrap to Bootstrap 5 has prov ...

Modify the nearest symbol after the (touch) operation on Angular version 6

On my list, I have caret icons displayed on the left side which should change when clicked. Clicking on one icon should trigger a change in all other icons as well. <div class="caret" *ngIf="summary.isSupervisor" style="position: absolute; left: 15px ...

What are the best practices for utilizing an array of routes?

I'm new to working with react but I noticed something strange. My routes are currently set up like this: <Main> <Route exact path="/home" component={Home} /> <Route exact path="/home1" com ...

Issues have been identified regarding webRTC video streaming on Chrome with Ubuntu 20, as the browser is

Streaming video over webRTC in AWS environments, all ports open and no firewall. Server 1: Ubuntu 18.04.5 LTS Server 2: Ubuntu 20.04.6 LTS On Server 1, after a few retries, webRTC successfully selects the correct candidate pair with my PC's public ...

access the ckeditor within the frame

I have a CKEditor in a frame and am experiencing an issue. When I try to console log from the browser, it won't work until I inspect near the frame and perform the console log again. [This is the CKEditor] https://i.stack.imgur.com/fWGzj.png The q ...

Can the navbar brand be centered in Bootstrap 4 while also aligning some text to the left of the brand?

Just dipping my toes into website coding and Bootstrap is a whole new territory for me. I'm struggling with centering the brand in the navbar while keeping the text aligned to the left of it. So far, every attempt results in both elements being center ...

What is the best way to check the contents of the text on the login page that appears a few seconds after the button is clicked

Currently, I am in the process of learning Selenium Webdriver and working on a code to populate a registration form for rediff.com. When opting for a rediffmail ID, there is a validation button that checks if the entered ID is available or not. If the ch ...

Display a notification when the browser is being closed, but refrain from showing the notification when the closure is due to logging off

When a user logs out of my application, the browser closes and triggers an alert. I want the alert to appear only when the browser is directly closed, not when it's closed through the logout process, where a different confirm message is shown. functi ...

incapable of hearing the node application

I'm currently working on developing an app using Node.js with Express and Socket.io, but I've encountered a problem. In my terminal, when I run the command node app.js, I receive an error message stating "TypeError: Object # has no method 'l ...

Connecting text boxes with JavaScript and JSON for gaming experience

I am currently developing a game and have encountered a slight issue. Currently, there is a text box in the game that prompts the player to run into it to progress to the next level. When the player does so, the next level loads seamlessly, which works per ...

ajax encountering error but producing correct result

Below is the code snippet for a function: side= 'car'; var request_checkUrl = '/antibot/antibot_data?script=' + side; $.ajax({ url: request_checkUrl, dataType: 'application/json', complete: function(data){ ...

Breaking Down URLs with JavaScript

I am looking to extract specific portions of a URL and here is my progress so far. <script type='text/javascript'> var query = window.location.pathname.split( '/' ); query = window.location.pathname.split( '.html' ); v ...

Can a ng-repeat value be assigned to a text input field?

<tr ng-repeat="person in users" ng-class="{'chosen': person.AdmissionID == currentSelection}" ng-click="selectRow(person.AdmissionID)"> <td>{{person.AdmissionID}}</td> <td>{{person.AdmissionNumber}}</td> ...

Issue encountered with Tesseract.js: Unable to run 'toBlob' function on 'HTMLCanvasElement': Exporting tainted canvases is not allowed

Currently using Chrome and a server set up using node. Below is the HTML code: <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie= ...

Enhance PHP code for user registration by incorporating parameterized SQL queries

I am fairly new to PHP and I've been exploring how to implement parameterized queries for my SQL connections. However, everything I come across gives me the impression that I have to manually change values each time to make use of parameterized querie ...

Create a horizontal bar graph displaying percentages using React.js

I am attempting to create a horizontal chart using react-chartjs where each data point displays as a percentage. import React, { Component } from "react"; import { HorizontalBar } from "react-chartjs-2"; export default class Button ext ...

Guide on transferring data from a component to App.vue in Vue 3, even with a router-view in the mix

I have the following layout: src components Footer.vue views Page.vue App.vue I want to access the 'message' vari ...

Utilizing a JavaScript variable in a separate file: A guide

I am facing a JavaScript challenge where I have a variable that changes its value on a particular event. Now, I need to access this variable in a different file for some calculations. For instance, in my index.php file, I have the following variable: ...

several ngGrids and ngGridEventScroll

There are 2 separate ng grids on a single page, each with infinite scrolling that loads server-side data on ngGridEventScroll. scope.$on('ngGridEventScroll', function(event) { ... }); Each grid is designed to make its own unique server-side cal ...