GithubHelp home page GithubHelp logo

[FEAT] Column width: auto about ag-grid HOT 34 CLOSED

ag-grid avatar ag-grid commented on May 21, 2024
[FEAT] Column width: auto

from ag-grid.

Comments (34)

ceolter avatar ceolter commented on May 21, 2024 7

Have you considered default autosizing to the Column headers if they are larger than the cell contents?
-> yes, it's no my list.

from ag-grid.

greglockwood avatar greglockwood commented on May 21, 2024 3

When you get around to doing this, I would love to see at least 4 "modes" for auto-sizing of columns.

  • None (current behaviour)
  • Fit Header (just wide enough to fit heading text in)
  • Fit Contents (just wide enough to fit largest contents)
  • Fit Header & Contents (wide enough to show all data without truncation)

I assume fitting the contents in will be the hardest, since that could change as new data gets loaded in. It would also be the slowest, due to having to measure each cell to get the width.

from ag-grid.

smwbis avatar smwbis commented on May 21, 2024 3

When you implement taking into account header for auto-size, would you consider doing it as an optional parameter in the api?

columnApi.autoSizeColumns(columns, includeHeadersBoolean)

There are times where it's nice to hide long column names to display more data. It would be nice to have the option to include or ignore headers when determining the size.

from ag-grid.

alexcouret avatar alexcouret commented on May 21, 2024 1

@ceolter Hi, sorry to bump up this thread but I can't seem to find if it has been implemented or not ? (Fit to the header's title in case its content is larger)

from ag-grid.

amcdnl avatar amcdnl commented on May 21, 2024

Possible dupe of #7 ?

from ag-grid.

tradiff avatar tradiff commented on May 21, 2024

I don't think it's a dupe.
#7 is suggesting making columns expand to fill the width of the parent div.
#41 is suggesting making a column expand to fit it's own content.

from ag-grid.

amcdnl avatar amcdnl commented on May 21, 2024

Ah, gotcha. Thats gonna be tough to achieve performantly.

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

Reckon we can break some rules to make it quick, eg assume fixed pixels per
text character (assumes plaintext default cell rendering), or could just
sample first 100 rows (render them off page, get max width of result).
On 6 Apr 2015 19:33, "Austin" [email protected] wrote:

Ah, gotcha. Thats gonna be tough to achieve performantly.


Reply to this email directly or view it on GitHub
#41 (comment).

from ag-grid.

amcdnl avatar amcdnl commented on May 21, 2024

Ya, but if you enable templates and whatnot it gets expensive fast and bug prone. Does slickgrid do this?

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

yes slickgrid has it:
http://stackoverflow.com/questions/6794656/how-do-i-autosize-the-column-in-slickgrid

also excel has it, ie double-click the RHS of the column header, would be
pretty cool if the grid did this.

On 6 April 2015 at 23:12, Austin [email protected] wrote:

Ya, but if you enable templates and whatnot it gets expensive fast and bug
prone. Does slickgrid do this?


Reply to this email directly or view it on GitHub
#41 (comment).

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Statements and opinions expressed in this e-mail may not
represent those of the sender. Any review, retransmission, dissemination or
other use of, or taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender immediately and delete
the material from any computer.

from ag-grid.

amcdnl avatar amcdnl commented on May 21, 2024

Looks like it does force fill and autosize! Just steal their code ;)

It would be really tricky to get 'row height' sizing with infinite scrolling!

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

not doing auto-row height - that's fixed - just width

don't think i'll take their code, just get inspired by the ideas!!

On 6 April 2015 at 23:21, Austin [email protected] wrote:

Looks like it does force fill and autosize! Just steal their code ;)

It would be really tricky to get 'row height' sizing with infinite
scrolling!


Reply to this email directly or view it on GitHub
#41 (comment).

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Statements and opinions expressed in this e-mail may not
represent those of the sender. Any review, retransmission, dissemination or
other use of, or taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender immediately and delete
the material from any computer.

from ag-grid.

tannerlinsley avatar tannerlinsley commented on May 21, 2024

👍 This would be great

from ag-grid.

ocombe avatar ocombe commented on May 21, 2024

This would be so cool, any news on this @ceolter ?

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

no closer to doing this i'm afraid. still on my to-do list.

from ag-grid.

chiptus avatar chiptus commented on May 21, 2024

👍

from ag-grid.

piernik avatar piernik commented on May 21, 2024

+1

from ag-grid.

Gratouille avatar Gratouille commented on May 21, 2024

+1

from ag-grid.

nileshmali avatar nileshmali commented on May 21, 2024

Any plans for this feature?

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

yup i still plan to do it, but i don't have the work scheduled right now.

from ag-grid.

amcdnl avatar amcdnl commented on May 21, 2024

@greglockwood you should chk out my project: https://github.com/Swimlane/angular-data-table ... its got some unique sizing techniques ... sorry @ceolter for plugging my proj ;)

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

@greglockwood @amcdnl lol no worries Austen. if someone thinks another grid is a better choice for them, that's fine with me. takes the pressure of some features i haven't gotten in yet!!!

from ag-grid.

nileshmali avatar nileshmali commented on May 21, 2024

@ceolter Is this candidate for v3?

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

@nileshmali nope
v3 is all about pinned columns (left and right) and multi level groups in the headers

from ag-grid.

ocombe avatar ocombe commented on May 21, 2024

Wooohoo is this what I think it is ?

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

this is now done, will be in the next release. if you double click the column header 'resize' bar, it will calculated the perfect width for the column.

@greglockwood i've decided to just resize the row data, not the header data, just doing the row data cells is enough to be better than the other grids.

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

@ocombe yup!!!! i'll release in the next few days. it works pretty dam good!!! i was banging my head for about 30min coming up with designs, then wallah, an idea sprung to my head that works!!!

from ag-grid.

ocombe avatar ocombe commented on May 21, 2024

Nice, can you call it programmatically as well (without having to tell the user to double click the resize bar)? For example call it once you've loaded the cells

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

yes. i put in two api methods, one takes one column, the other a list of columns.

from ag-grid.

ocombe avatar ocombe commented on May 21, 2024

That's perfect, I'll put it on the todo list for our app at work, thanks a lot !! :)

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

@ocombe welcome!

from ag-grid.

mpetkov avatar mpetkov commented on May 21, 2024

So has the "Fit Contents" option been added? If so, where can I get the documentation on how to use it and what version is it available in?

from ag-grid.

ceolter avatar ceolter commented on May 21, 2024

@mpetkov
https://www.ag-grid.com/change-log/changeLogIndex.php
3.1.0
Major: Implemented auto-size for column. Now columns can be told to fit their content.

from ag-grid.

outofgamut avatar outofgamut commented on May 21, 2024

Have you considered default autosizing to the Column headers if they are larger than the cell contents? For example, with the current autosize function, if I have a long column name and the column just has an icon in it, the name of the column is truncated.

from ag-grid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.