Resolve the column alignment issue within the Twitter Bootstrap table

I have a table that becomes scrollable if the screen size is too small to comfortably view the whole table (table-responsive). However, there is one column in my table that I want to stay fixed. It is always the same column that needs to be fixed (the second column - for example: "Student"), but the width of the 'Student' cells in each table may vary. I have multiple tables on the site, some of which are hidden and only one is shown at a time. Is it possible to make this fixed column work across all tables?

Example (Ensure window is less than 800px wide to see scrolling):

jsFiddle: http://jsfiddle.net/8nXvf/

Answer №1

Indeed, achieving this is feasible, although it may not be a straightforward task. Essentially, you must assign a new class to each column header and cell individually (unlike in a table layout where they are grouped by column). Following that, you'll need to implement some CSS for this class to configure the position as absolute, in addition to making a few other adjustments (such as widths, etc).

Check out this previous question/answer on StackOverflow for more information.

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

How to use jQuery to convert Latin letters to uppercase in input text

When using the text-transform: Uppercase property, it works fine. However, there is one issue - when I type a lowercase "i", it displays as an uppercase "I" instead of the Latin letter "İ". Is there a way to achieve this using jQuery or another method? ...

Unveiling Fresh URLs within an iFrame

Here is the current situation: www.mywebsite.com/Pagex.html - On this page, there is an iFrame with a default URL (src) from a different domain than the host page (Pagex.html). The code inside the iFrame is a user input form with a submit button. Upon su ...

Combining Two DIVS Side by Side

Hey there, I am working on a timeline using two divs within a table cell. My goal is to have these divs overlap instead of appearing one below the other. The position attribute for all the DIVs inside the cell must remain unchanged due to the drag/drop fu ...

When a certain condition is met, Jquery will extract the values from 2 input fields, perform a multiplication operation on the values, and then place the result

Reference to http://api.jquery.com/val/ for assistance with creating a code snippet that retrieves values from 2 input fields, multiplies them, and inserts the result into a third input field. An example is available at this link: http://jsfiddle.net/KWEy ...

How can I incorporate the "onClick()" function within an ajax call, while still utilizing the data returned in the success message?

After successfully making an Ajax call, I would like to implement an on-click function while still utilizing the original data retrieved. $.ajax({ URL: ......, type: 'GET', success: function (res) { var Ob ...

Utilizing a single delete function for a post request in jQuery or a PHP request

Seeking guidance on how to achieve a specific task. I have a controller that loads a view containing a table listing pages from my database. Each row in the table has an icon that, when clicked, performs one of two actions. If the user does not have javas ...

List organized in two columns utilizing the data-* attribute

Is it possible to display a list in a two-column format based on a data attribute of each item? <ul> <li data-list="general_results">general text1</li> <li data-list="general_results">general text2</li> <li dat ...

Prevent scale animation for a specific section of the icon using CSS

I need help in preventing the scale animation of the :before part of the icon class from occurring when the button is hovered. The current behavior is causing the arrow to look distorted on hover... Link to the code on Codepen HTML <div class="se ...

passing HTML table row information to a function

My HTML table contains a button that, when pressed, prints data from a particular row as an alert. However, the function executes even when clicking on separate cells. I need help to stop this behavior. Can you assist me with this? Here is the link to th ...

Trouble with jQuery call in an external JavaScript file?

Just starting out with Javascript and JQuery! Currently using MacOSX 10.8, Safari Version 6.0.3 (8536.28.10) I've created a basic HTML page with a form: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xh ...

Enhance your website with a unique hover and left-click style inspired by the functionality of file explorer

I have a set of items like this: I am trying to replicate the functionality of a file explorer in terms of item selection. To clarify, I aim to create a feature where hovering over an item and left-clicking it would generate a virtual rectangle to select ...

Creating dynamic qtip2 tooltips is an effective way to enhance user interaction on

I am facing an issue where all tooltips work perfectly fine when the page loads, but stop working after data refreshes through ajax. How can I resolve this problem? $(document).ready(function() { // MAKE SURE YOUR SELECTOR MATCHES SOMETHING IN YOUR HT ...

Struggling to achieve full height for div content between header and footer using Bootstrap 4?

This post may seem similar to others, but it's not. Please read carefully. I am looking to make the main container (<main role="main" class="container">) full-height between the header and footer using Bootstrap 4. Here is my HTML code: // I ...

Guide to manually creating and accessing an array of objects in Firebase using Angular

I have successfully generated a dynamic list of cards from an array of objects stored in the user.component.ts file. user.component.ts import { Component, OnInit } from '@angular/core'; import { AuthService } from '../service/auth.service& ...

Controlling the content of a .html file programmatically

I have a question regarding an html file in my asp.net webforms project that is downloadable when a button is clicked. Is there a way to dynamically generate <select> lists and include them in specific sections of the html file based on database val ...

Can I Intercept POST Array with JQuery before Sending it?

Can I capture the POST Array with JQuery before sending the form? I'm aware of using preventDefault() to access all variables, but that's not my desired approach. I need to retrieve the POST Array prior to sending it via AJAX to a php file. ...

Optimal approach for creating a CSS button with a dynamic size, gradient background and arrow design

I'm utilizing the Zurb Foundation framework and aiming to create dynamic call-to-action buttons with varying sizes, text, a background gradient, and a right-pointing arrow. There are three potential approaches I've envisioned: Employ an a el ...

Deletion of class in vue.js - a step-by-step guide

Being a newcomer to Vue.js, I'm seeking assistance on effectively removing a class from an element, similar to how it's done in JQuery. $('.class1').removeClass("class2"); ...

Guide on how to refresh the page following a post

Currently in the process of building a form within OctoberCMS that triggers a PHP code block. HTML/Twig: {{ form_open({ request: 'onHandleForm' }) }} Please input a string: <input type="text" name="value"/> <input type="submit" ...

Mastering JSON looping for each distinct group

I'm new to JavaScript and recently encountered an issue with JSON. Here is the object I am working with: var users = [ { "firstName":"John" , "lastName":"Doe" }, { "firstName":"Anna" , "lastName":"Smith" }, { "firstName":"Peter" , "lastName": ...