Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Feature Request - function to autosize cols in a table  (Read 8788 times)
Tim B.
Posts: 67


« on: November 25, 2008, 01:18:35 pm »

It is difficult to know how to size columns in a table in program, especially when creating the table dynamically.  The best you can do is guess based on the estimated size of what is going to be returned. 

If you double-click the heading in between two columns it auto-sizes the left column.  It would be useful if there was a function or attribute which could do this.
Tim S.
Posts: 26


« Reply #1 on: November 25, 2008, 02:43:42 pm »

Please add my vote to this request also.
Reuben B.
Four Js
Posts: 1049


« Reply #2 on: November 25, 2008, 09:45:53 pm »

It is difficult to know how to size columns in a table in program, especially when creating the table dynamically.  The best you can do is guess based on the estimated size of what is going to be returned. 

If you double-click the heading in between two columns it auto-sizes the left column.  It would be useful if there was a function or attribute which could do this.

I don't know if you have noticed but that double-click only sizes based on the data that the GDC knows about i.e. the rows that are visible.

You can set the width attribute of the column by manipulating the DOM tree.  I've done that successfully in a routine that essentially takes the output from a SQL statement and dumps it into a DISPLAY ARRAY.  For each column set the width attribute to an appropriate value for the data in that column.

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Tim B.
Posts: 67


« Reply #3 on: November 26, 2008, 10:15:10 am »

I don't know if you have noticed but that double-click only sizes based on the data that the GDC knows about i.e. the rows that are visible.

You can set the width attribute of the column by manipulating the DOM tree.  I've done that successfully in a routine that essentially takes the output from a SQL statement and dumps it into a DISPLAY ARRAY.  For each column set the width attribute to an appropriate value for the data in that column.
I'd not noticed this, but I shouldn't think It will be a big problem.  I'd thought of checking the length of data in each column in the array (as well as the column title), but it's bit of a long winded way of doing things, and the WIDTH attribute is (I think) in grid chars which isn't really the same as the width the data occupies in the table due to the differences in font size.
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines