Ways to conceal a section of columns within a table

I am working on a table that combines 2 separate tables.

<div>
        <div>
            <table>
                <colgroup>
                    <col style="width:95px" />
                    <col style="width:95px" />
                    <col style="width:95px" />
                    <col style="width:95px" />
                    <col style="width:95px" />
                </colgroup>
                <tr class="header">
                    <th colspan="2">Header1</th>
                    <th colspan="3">Header2</th>
                </tr>
                <tr>
                    <th>data1</th>
                    <th>data2</th>
                    <th>data3</th>
                    <th>data4</th>
                    <th>data5</th>
                </tr>
            </table>
        </div>
    </div>
    <div>
        <table>
            <colgroup>
                <col style="width:95px" />
                <col style="width:95px" />
                <col style="width:95px" />
                <col style="width:95px" />
                <col style="width:95px" />
            </colgroup>
            <tr>
                <td>data1</td>
                <td>data2</td>
                <td>data3</td>
                <td>data4</td>
                <td>data5</td>
            </tr>
            <tr>
                <td>data1</td>
                <td>data2</td>
                <td>data3</td>
                <td>data4</td>
                <td>data5</td>
            </tr>
        </table>
    </div>

My goal is to be able to click on a cell in the first header row and collapse all columns in the group except the first one. For example, clicking on Header2 should hide data4 and data5 columns while showing only the data3 column. Clicking again would reveal all the hidden columns back.

Is it possible to achieve this functionality using only Angular and CSS without relying on jQuery?

Thank you, Chen

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

MongoDB Driver Alert: MongoError - Cursor Not Found. Cursor ID 7820213409290816 was not located in the specified namespace db_name.collection_name

Having successfully created a Nodejs API server that connects to AWS MongoDB (version: 3.6), everything seems to function flawlessly when calling one specific API endpoint (api/lowest). However, upon making multiple simultaneous calls to this API (15 in to ...

Executing Python script via AJAX or jQuery

I need to execute Python scripts from JavaScript. The goal is to provide an input String to the Python script as an argument and then showcase the output on our webpage. Below is the Python code that runs smoothly on my Linux box: ./sample.py 12345 produc ...

Trigger a JavaScript/jQuery alert if the text input field contains a specific string

I am currently facing an issue with a text field (id=#CAT_Custom_244677) that gets populated by a JavaScript date picker. My goal is to display an alert message if the user selects a date that includes '2013' in the text field value. However, I h ...

Gather data from all input sources and compile it into a well-organized

I'm looking to convert HTML form inputs into JSON format. Initially, I attempted to achieve this using jQuery's serializeArray method, which worked fine for simple input names. However, when dealing with multidimensional input names like: <i ...

Touch screen scrolling has been observed to significantly reduce the speed of AJAX downloads in Chrome

There is an unusual issue I am experiencing with an AJAX request that hangs intermittently when scrolling with a finger on a touch-enabled device. The problem occurs as long as the finger is held down while scrolling. It's difficult to explain the pro ...

Encountering an issue with Spring file uploads due to the presence of the 'Access-Control-Allow-Origin' header on the requested resource

An error occurred in the File Upload API when making a POST call from AngularJS. Below is the code for the File Upload API in FileUploadController.java @RestController @RequestMapping(value="/v1") public class FileUploadController { @Autowired pr ...

Adjust both scrollLeft and scrollTop at the same time

Is there a way to adjust both scrollLeft and scrollTop of a div at the same time? It seems to work in Chrome, Safari, and Opera when set sequentially, but Firefox (older than 4) and IE (even in IE9!) experience glitches where the page moves left and then d ...

Video background mute feature malfunctioning

I've searched through numerous resources and reviewed various solutions for this issue, yet I still haven't been able to figure it out. Could someone please guide me on how to mute my youtube embedded video? P.s. I am a beginner when it comes to ...

Looping HTML5 audio with Javascript

function switchSongs() { var songOptions = ['1507', '1530']; // array of available songs var audioPlayer = document.getElementsByTagName('audio')[0]; for (var i = 0; i < songOptions.length; i++) { i ...

iterative string ng-list that is specified in the text $scope variable

Is there a way to set up a dynamic ng-repeat in $scope variable that looks like this: $scope.radioOptions =[{value:1,name:'radio1'},{value:2,name:'radio2'}]; $scope.item = { model: "radio", radioOptions:'opt in radioOptio ...

searching for child elements as you traverse up the DOM structure

It might sound a bit confusing, but here's what I need. I want to locate the children (OF CLASS PARENT) when the user clicks on the target class. Important: I do not know the specific classes of the children and child within the HTML structure. Th ...

Track every click on any hyperlink throughout the entire webpage

I am attempting to capture any click event on a link throughout the entire page. For example, when a user clicks on the following link: <a href="/abc">abc<a/> I want to be able to retrieve the anchor tag like so: <span hre="/abc">abc& ...

Laravel vue infinite scroll failing to load additional content

I've been trying to implement the infinite scroll feature from Element UI in my app, but for some reason, it's just not working. Here's a snippet of my code: Code script // Your JavaScript code goes here ...

The issue with the page width is occurring due to a bug related to the

When pages contain the AddThis code, they tend to become very wide due to the code itself, resulting in a horizontal scroll bar appearing. However, by removing the code or changing the page direction to LTR, the issue is resolved and the page width return ...

Establish a connection with a distant socket.io server using a Django server

I am currently facing a challenge in developing a real-time Django application. Due to the limitations of my hosting service, I am unable to run a Websocket server concurrently with my Django server. To enable user-to-user interactions, I took the approac ...

What is the reason for having a space between the <body> and the <html> tags?

Can you explain why there is a gap between the top of the green box and the browser window in Chrome and Firefox? I've tried various CSS configurations to eliminate the apparent space between the html and body elements, but it seems that some padding ...

Searching the database to find if the username is already in use with MEAN

Help needed with signup controller code! app.controller('SignupController', function ($scope, $http, $window) { $scope.submitSignup = function () { var newUser = { username: $scope.username, ...

A mistake occured: Unable to modify the stack property of [object Object], as it only has a getter method

Encountering an error when attempting to use a service in my component and declaring it in the constructor - TypeError: Cannot set property stack of [object Object] which has only a getter This is the code snippet: import { Component } from '@angula ...

Spinning a 3D shape on its y-axis using three.js

Recently I delved into the world of three.js and came across an interesting project that I am trying to tweak. I am curious to find out if there is a way to make the globe object rotate around its y-axis with minimal changes to the existing code, or if a ...

Display a list of items, and if there are more than two items, switch to a mat-menu

I have a collection of items that I would like to display. In cases where there are more than two items, instead of showing all the items, I want to display a button with the number of remaining items and their names. <div *ngFor="let item of item ...