A unique design featuring a Bootstrap table with two horizontal columns of differing lengths in every row

Recently, I decorated a table using bootstrap and created a simple table view (collapsed) to display the data. Each row in the table contains two horizontal sets of data, with the expanded view appearing when the user clicks on the "Details" button.

The first set of data in each row consists of 4 columns, while the second set is intended to occupy the entire table width. However, I am not completely satisfied with my current approach. It involves utilizing Angular loop constructs to repeat the <tr> element and embedding two tables within each <tr>. This setup allows me to present the first data set in one table and the expanded view in another table, triggered by clicking on the "Details" button.

<table class="table-hover table-condensed">
    <thead>
        <tr>
            <th align="left" class="span2">Date</th>
            <th align="left" class="span2">Title</th>
            <th align="left" class="span2">Bill Total</th>
            <th align="left" class="span4">Options</th>
        </tr>
    </thead>
    <tbody>
        <tr ng-repeat="ibill in user.groups[0].bills | filter:query | orderBy:'date'">
            <td colspan="4">
                <table>
                    <tr>
                        <td class="span2">{{ ibill.billDate | date:'MM/dd/yyyy'}}</td>
                        <td class="span2">{{ ibill.title }}</td>
                        <td class="span2">${{ ibill.billTotal }}</td>
                        <td class="span4">
                            <a ng-click='deleteBill(ibill.id)' class="btn btn-mini" ng-init="ibill.isCollapsed = 'true'" ng-click="ibill.isCollapsed = !ibill.isCollapsed"><i class="icon-trash"></i></a>
                            <a href="#/bills/edit/0/{{$index}}" class="btn btn-mini" ng-init="ibill.isCollapsed = 'true'" ng-click="ibill.isCollapsed = !ibill.isCollapsed"><i class="icon-edit"></i></a>
                            <a class="btn btn-mini" ng-init="ibill.isCollapsed = 'true'" ng-click="ibill.isCollapsed = !ibill.isCollapsed"><i class="icon-eye-open"></i>&nbsp;details</a>
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td colspan="4">
                            <div collapse="ibill.isCollapsed">
                                <div>
                                    <p ng-repeat="simplecost in ibill.billSimpleEntry.simpleUserIdAndLiableCost">{{simplecost.user.fName}} owes ${{simplecost.liableCost}}</p>
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </tbody>
</table>

However, I'm considering alternative designs that eliminate the need for two tables per row. I'm exploring options for achieving the same functionality without relying on traditional tabular structures. Is it possible to create a similar layout without tables?

Answer №1

An alternative approach to using tables is to utilize the colspan attribute within a td element. Here's an example:

<table>
    <tbody>
        <tr> <!--regular row content-->
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td colspan='4'><!--additional details--></td>
        </tr>
    </tbody>
</table>

By setting the colspan to 4 in this scenario, the td element will span across all four cells from the preceding row, creating a single cell of equal width.

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

"Return to previous page" feature

I am having difficulty figuring out how to implement the "go back" function for the page. For instance, I have pages A, B, C, and D. The possible switching between pages is as follows: A -> (B <-> C) -> A or D -> (B <-> C) -> D (w ...

What is the best way to position my header at the top of my navigation bar?

I am new to the world of HTML and CSS! My goal is as follows: https://i.stack.imgur.com/hmLNS.png This is my progress so far: https://i.stack.imgur.com/rav8P.png I am also looking to have the header fill the entire browser window and remain fixed, wit ...

Chrome Bug with Fixed Position Background

Just finished creating a website that features fixed images as backgrounds with text scrolling on top of them. I've noticed an issue when using Chrome - the scrolling stops briefly between backgrounds, pauses for about a second, and then resumes. I&ap ...

Revising HTML content when Angular array is modified

I have a code snippet below where I am updating the value of an object in the first item of an array. However, I'm struggling to find a way to "refresh" the HTML view so that the changes are immediately reflected on the browser. var dataArr ...

The occurrence of "Error [ERR_STREAM_WRITE_AFTER_END]" was noted when trying to write to an HTTP server in

How to set up a new http server using Node.js After launching the server, the initial HTML text is displayed correctly. However, moving to other links in the code (e.g., localhost:5001/about) results in an error appearing in the IDE console. events.js:377 ...

The optimal method to showcase lists of names: HTML or CSS?

I have a roster of 40 individuals, complete with their titles and additional details akin to a yearbook layout without the actual photos. Previously, I relied on HTML tables to format this information, but I am contemplating whether there might be a more e ...

Implementing Oauth in Angular and Node

I am facing challenges with implementing oauth in Angular. When I directly enter the link into the browser http://localhost:8080/auth/twitter I am able to successfully connect using oauth and receive a response. However, when I try to achieve the same in ...

The jQuery Date Picker popup appears beneath a different element on the webpage

The Datepicker is functioning properly. https://i.sstatic.net/DKQcq.png Issue with Datepicker overlapping search box with auto-complete feature. https://i.sstatic.net/pj6T7.png I'm baffled as to why my JQuery Datepicker works flawlessly in most ca ...

The page fails to load completely in headless chrome on Ubuntu 18.04 while using Robot Framework

About the Web Application Under Test: The application has been developed using a combination of Angular JS and React. Issue: While using Robot Framework to navigate from the home page to another page, we encountered a problem where the page was only parti ...

Arrange an HTML div element within the confines of a mobile phone graphic

I'm currently working on implementing a unique slideshow that will be embedded within an image of a smartphone on my website. I have found that using Owl Carousel makes creating the slideshow itself quite easy, but now I am faced with the challenge of ...

Avoid allowing wysiwyg source code editor to alter the entirety of a website

Currently, I am implementing a WYSIWYG editor named "Jodit" on my website. This editor allows me to insert HTML code and add custom styling using the "!important" declaration, which can alter the CSS of the entire website. For example, you can visit Clic ...

Panel with Bootstrap Collapse feature causes a slight movement when padding is applied

After applying the collapse behavior to a panel element, I noticed that the animation stops abruptly at the padding of .panel-body, causing it to snap instantly to height. This issue can be observed in the basic example on codepen: http://codepen.io/FiveSi ...

Creating a standalone Wordpress child theme with its own CSS

After creating a child theme based on the responsive i-transform theme from http://templatesnext.org/itrans/, I found myself continuously undoing the i-transform CSS, which is taking up a lot of my time. However, if I remove the entire parent stylesheet, t ...

Changing the color of Material UI pagination: a step-by-step guide

I have integrated Material UI to create a pagination bar for my website. While everything is functioning properly, I am looking to personalize the appearance. After reviewing their documentation, I tried implementing a theme but encountered an issue with c ...

populate a bootstrap column with numerous span elements containing varying numbers on different rows

Wondering if it's possible to have a div with the bootstrap class "column" filled with multiple span elements that may break into more than one line. The challenge lies in making sure that each line of spans stretches and fills the line, even if there ...

Uploading files in AngularJS without the need for external plugins

I am in need of code to enable multiple uploads using Angular. The requirements for this task include displaying the name and size of a file before it is uploaded, without the use of any plugins. Additionally, the code needs to be compatible with IE9. Ca ...

Is it possible to save an entire webpage that infinitely scrolls without actually manually scrolling through it?

I'm dealing with a webpage that has infinite downward scrolling. I tried automating the scrolling, but eventually the page became too large to continue scrolling. To fix this, I manually removed some DIV blocks from the source code which decreased the ...

the typeahead.js method in Twitter's process() function is filling the list with undefined values

I am encountering a similar issue as described in the thread Twitter Typeahead Ajax results undefined. Since that problem remains unresolved, I am revisiting the topic with hopes of shedding light on any missing details. My setup includes standalone Typea ...

Modifying the content within a DIV element

I want to make changes to my DIV. <div id="main"> <div id="one"> <div class="red"> ... </div> <img class="avatar" src="img/avatar1.jpg"/> <span class="name"> John < ...

Hover over the first element to remove its class and replace it with a different element

I am attempting to develop a function that adds the class = "actived" to the first Element. This class has a CSS style that highlights the element in question. I have a list of 4 lines and I want the first one to automatically receive this class, while t ...