Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support variable width row headers #475

Closed
chahu opened this issue Mar 6, 2013 · 13 comments
Closed

Support variable width row headers #475

chahu opened this issue Mar 6, 2013 · 13 comments

Comments

@chahu
Copy link

chahu commented Mar 6, 2013

I'm working on a project which is attempting to use handsontable, however we're running up against the fact that the row-header-column is a fixed width (and not very wide). This cause the vast majority of our row header labels to be truncated. One alternative is to tweak the CSS and widen that first column a fixed amount, but this is not an option as the data we are displaying could vary in length/width. I've also tried changing the CSS and commenting out some of the lines with "width: 0" -- this "works" in that the row-header-column does indeed become variable width, but the scrolling logic becomes buggy.

Long story short, how can I get the below to show my row headers (without having a fixed-width column) and keep the nice scrolling functionality:

http://jsfiddle.net/4587J/6/

Thanks!
Charlie

@scottfrenz
Copy link

I second this request. I have header cells that need large widths as well. Thanks!

@setthase
Copy link

Seems to be similar to #328

@chahu
Copy link
Author

chahu commented Apr 29, 2013

Yes, it is very similar, and I found that thread long ago, however the suggested solution did not fix the problem. If you're able to modify the CSS as suggested on my jsfiddle example and cause the rows to be variable width and scrolling to continue to work I'll be happily mistaken.

Regards,
Charlie

@ajlaventure
Copy link

I am also running into this issue as well where you can't scroll to the last cell. I plan on calculating the visible columns, average column size, and setting the width of the table so it's the browser's scroll bar and not the handsontable.
An option to have the table always be max width and use browser's scroll bars would be nice as well

@warpech
Copy link
Member

warpech commented May 21, 2013

Version 0.9.0 no longer uses hard-coded row header width. Thanks for reporting this!

@warpech warpech closed this as completed May 21, 2013
@warpech
Copy link
Member

warpech commented May 21, 2013

But you still have to define row header width using CSS - http://jsfiddle.net/4587J/9/

@chahu
Copy link
Author

chahu commented May 30, 2013

There is still no support for "variable width row headers". Your solution (below) hardcodes a width of 180px in the css. This won't work if a row header is a very long string longer than 180px, nor will it look good when all the row headers are very short. Since this issue was titled "Support variable width row headers", I think should remain open.

Thanks.

.handsontable col.rowHeader {
    width: 180px;
}

One additional comment: I do appreciate the situation is improved as you make it easier to define a fixed column width for the row headers. However, the idea is that the row headers are not known apriori during development and will vary as the table is populated dynamically.

@nkoren
Copy link

nkoren commented May 9, 2014

I'd like to echo the request to re-open this issue, since it has clearly not been addressed (there is no way to dynamically resize row headers).

@jingzans
Copy link

Does anyone know how to right align the row header?

This doesn't seem to work:

.handsontable col.rowHeader {
width: 180px;
text-align: right;
}

@tartor
Copy link

tartor commented Mar 19, 2015

Workaround
in the config implement afterLoadData callback to change the width of all the elements that have class name 'col.rowHeader'

var ht = new Handsontable(
document.getElementById(id),
{
afterLoadData: function(){
var rowHeaders = document.getElementById(id).querySelectorAll('col.rowHeader');
if (rowHeaders.length != 0) {
for (var j = 0; j < rowHeaders.length; j++) {
rowHeaders[j].style.width = "200px";
}
}
}
}
);

where id is the id of the html element which holds the handsontable

@realtebo
Copy link

Is there any CSS way to defined a 'auto-width' for row headers ?

@donmccurdy
Copy link

Could this issue be reopened? The JSFiddle posted by the OP (which I've updated with fixed links to CDN js/css) is still showing row headers fixed at 50px. As pointed out, the 50px can be overridden in CSS, but this isn't ideal.

@realtebo No, not without using JavaScript to calculate what the magic width should be, and then applying it in CSS.

@AMBudnik
Copy link
Contributor

@donmccurdy this issue is continued (and marked as a bug) at #2868

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests