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

  • Home
  • SEARCH
  • 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 7978929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:37:34+00:00 2026-06-04T09:37:34+00:00

I want to dynamically collapse table column to specific width (10 px in this

  • 0

I want to dynamically collapse table column to specific width (10 px in this case) whenever user clicks on column header. It will be good if we can keep the cells height fixed while changing the column width.
For example table will be displayed like:
enter image description here
When user clicks on column header (red minus button here), column should shrink and should look like:
enter image description here
Here in example given in jsFiddle column shrinks to fixed width and height remains same.

Here is what I have tried till now JsFiddle.

I have used:

  table-layout:fixed;
  word-wrap:break-word;    

but column shrinks to the width same as first word. It don’t break the work to make width 10px.
Here column width shrinks to adapt word Lonnnnng.

It will be great if we get any plugin like datatable which allows this feature (i.e. dynamic collapse and expansion of columns to a particular width). There are many plugin which allows user to hide particular column but I want to shrink it instead of hiding.


EDIT :

After trying few suggestions I realize that a plugin will be better solution for this as I have to look after all browser and resolution supports.Doing all this stuff through written code will be the last thing I will do [I have to do 😀 ].Do we have any plugin which provides such feature?

  • 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-04T09:37:36+00:00Added an answer on June 4, 2026 at 9:37 am

    The important part missing from your solution is setting the table width. Once the table width is fixed (e.g. set to 100%) the column width becomes fixed as well. You can see it here: http://jsfiddle.net/9QkVd/1/

    My example code also toggles the collapsed class instead of manipulating CSS values directly, this is a more reliable approach. And the same class is set for all other cells in the column to allow applying text-overflow: ellipsis there as well.

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

Sidebar

Related Questions

I want to dynamically use TOP or not sort of like this... SELECT @SomeNumber
I want to dynamically add rows to the table, what I achieve by cloning
I want to dynamically generate bands, that will then be grouped in reports. My
I want to dynamically reference an XSD from a bean, how is this possible?
i want to dynamically add a class to all rows of a table except
I want to dynamically access value of variable, let's say I have this array:
I want to dynamically change the CSS for a specific element. The following hard
I want to dynamically assign width to a label depending upon the text length
I want to dynamically change the layout, based on whether the user is accessing
I want to dynamically control location tracking (registering / unregistering location broadcast receiver). This

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.