Custom column width and Horizontal Scroll?
Does Griddle support custom column width? Would be really nice to be able to specify column width as absolute (px) or relative (%). I believe currently the columns are equally sized as per available width.
Also any chance of getting horizontal scroll for tables with a large no: of columns?
Btw, great work guys, otherwise Griddle is nice, light and quite functional!
You can do this by ensuring that you haven't specified "table-layout:fixed" in the CSS for the Griddle table and then use cssClassName in the columnMetadata option to set column widths as you like.
Hi there and thanks for the kind words. The next version of Griddle has the more "infinite" horizontal scroll as well as vertical.
As far as column width -- the suggestion made by @jgwconsulting is a good solution for now. We're hoping to have more customization options for 1.x.
Awesome, both column width and horizontal scroll works! Thanks @jgwconsulting :+1:
Appreciate the quick response @jgwconsulting and @ryanlanciaux :smiley:
We found some accessibility issues during our testing, I hope we can fix and contribute them?
hi, can you please publish a small example of how to control column width with cssClassName? Thank you !
Look at cssClassName property under Column Metadata here: http://griddlegriddle.github.io/Griddle/customization.html
eg:
<Griddle
columnMetadata = {[
{ columnName: "label", displayName: "Name", cssClassName: "LabelColumn"},
.
.
]}
/>
and in your CSS
.LabelColumn{
width: 150px;
}
You can also experiment with max-width too.
thank you mr-bobz, it worked. Almost... I am using infiniteScroll and fixedHeader, and with this particular combination the trick does not good - it works only for the titles, and not for the whole table... I saw vidhib reported this bug in https://github.com/GriddleGriddle/griddle-render/issues/18, but i didn't find any more references to this issue.. Any idea if it had been fixed? Even a non-official version will do, Griddle is a lovely table, the best i've seen so far!
Thanks @pupsanka and sorry about the delay in response. Sorry to hear this is not working out so well. We're working on a new version that will hopefully make this sort of operation a lot nicer. The issue you referenced is not yet resolved but should be with 1.0.
Any progress on this? THe problem i'm facing is the table is 100% and inside a grid layout that is auto width base (bootstrap's md-10). So how can you set a fixed with for selected columns when the others are not fixed? Or the table is not fixed?
So the table-layout: auto is inline style. Where do we override this to turn it off so it works for using cssClassName?
<table class="" style="width:100%;table-layout: auto;"
Seems like the issue was i had useFixedHeader. Took that out and now my cssClassName works
It be nice if we can drag and set the width like Microsoft's Excel spreadsheets.
@aaronucsd I'm glad you found a workaround for the time being. We do plan on adding the ability to drag column widths as a plugin in 1.0
Sweet! On Mar 3, 2016 6:24 PM, "Ryan Lanciaux" [email protected] wrote:
@aaronucsd https://github.com/aaronucsd I'm glad you found a workaround for the time being. We do plan on adding the ability to drag column widths as a plugin in 1.0 http://griddlegriddle.github.io/Griddle/next/docs/plugins/usingPlugins/
— Reply to this email directly or view it on GitHub https://github.com/GriddleGriddle/Griddle/issues/282#issuecomment-192065631 .
Any example for horizontal scroll ?
It worked for me
@aaronucsd I wanted to keep the fixed header since we have infinite scroll enabled so I did the unthinkable and mixed jQuery and React. I did something like this to override the inline styling applied to the body <table>
componentDidUpdate: function () {
$("table:eq(1)").attr("style", "width:100%");
}
Alongside using a custom CSS class for the columns. Super hacky, but hey it works.
Is there a better solution than what I'm doing while keeping the fixed header?
Thanks
All -- thank you for the discussion here. We've released Griddle 1.0 and have a new customization model that may make interacting with column widths easier. Please take a look at the styles section and customization section from the docs.
Closing this one for now but please feel free to open a new issue if any problems are encountered. :+1: