Four Js Development Tools Forum

General => Ask Reuben => Topic started by: Reuben B. on April 13, 2020, 06:18:13 am



Title: Ask Reuben 2 - Align Column Headings With Their Data
Post by: Reuben B. on April 13, 2020, 06:18:13 am
My table column headings are left justified / aligned but the data is numeric and is hence right justified / aligned.  How can I make the column headings align with the column detail?
 
Use the headerAlignment Table Presentation StyleAttribute and set the value to auto.  This will align the column heading with the data in the column, rather than the default of left justifying the column heading.  Thus column headings for numeric columns will be right justified.

Read more at https://4js.com/ask-reuben/ig-2/


Title: Re: Ask Reuben 2 - Align Column Headings With Their Data
Post by: Rene S. on April 14, 2020, 08:38:26 am
Hello Reuben,
I appreciate your articles at "ask reuben".

But...
The article "Align Column Headings With Their Data" explains a workaround for a front-end bug or weakness. The runtime has told the front-end the expected alignment. See the attribute TableColumn.numAlign. If the value is "1" then any data must be displayed right-aligned. That's the case. What's wrong? This includes the table-header.

That's why: I wonder. This article should not exist. A bug should be created. I wonder more. Why nobody has ever raised this issue (in the context of: this is a bug).

Rene


Title: Re: Ask Reuben 2 - Align Column Headings With Their Data
Post by: Reuben B. on April 15, 2020, 01:01:04 am
Rene,

There were some internal discussions 10 years ago around your point when the headerAlignment presentation style was added in 2.30.  For our readers, it illustrates some of the decisions we have to make when adding new functionality

The GDC upto this point had been the equivalent of headerAlignment=left

There had been a number of requests to be able to change the alignment of table headings.  Tasks were created to implement the ability to change alignment of table headings for 2.30.  These tasks were https://4js.com/support/issue/?id=FGL-1428 and https://4js.com/support/issue/?id=GDC-160.  (Interestingly I think 'auto' wasn't in the original enhancement but was added as the task progressed)

Some of the discussions were wether to set the default value to match the existing behaviour of headerAlignment=left, or wether we set the default value to be one of the new values center, right, or auto?

Well known programs were looked at, Windows Explorer was the equivalent of headerAlignment=left.  Windows Task Manager was the equivalent of headerAlignment=auto.  Microsoft Access was the equivalent of headerAlignment=center.

Some customers were surveyed to see what they thought the default value should be.  There wasn't a clear consensus.

In the end, the decision (rightly or wrongly) was made to keep the new default behaviour the same as the existing behaviour that is the default of headerAlignment=left, and therefore minimise inconvenience to existing customers.   

This can always be revisited with any major release, that is change the default value and add a note in the upgrade guide.

Reuben