openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

[sap.m.Label] placed in sap.m.Column - wrong textAlign

Open dvorpahl opened this issue 12 years ago • 4 comments

OpenUI5 version: 1.18.8 Browser/version: Google Chrome 35.0.1883.0 canary

URL (example): http://jsbin.com/diyaxibu/1/edit?js,output

What is the expected result? style: "width:100%; text-align:right"

What happens instead? style: "width:100%; text-align:left"

Any other information? using a standalone label will create correct html code, using label in Table/Column the text-align is set to left.

dvorpahl avatar Mar 12 '14 15:03 dvorpahl

Hi Danilo,

the table-renderer ignores the label's textAlign because it uses the one from sap.mColumn. If you create a Column and set the hAlign to sap.ui.core.TextAlign.Right, it works: http://jsbin.com/diyaxibu/5/edit?js,output

Bes regards, Jens

sirion avatar Mar 12 '14 19:03 sirion

Hi Danilo and Jens,

This is an intentional behavior but actually documentation of the Column#hAlign was wrong and we corrected at the latest version.Here is the new docu for Column#hAlign Horizontal alignment of the column content. Available alignment settings are "Begin", "Center", "End", "Left", and "Right". NOTE: Controls with a "textAlign" property inherits the horizontal alignment from Column.

Custom CSS seems like the best solution if you want to have different text alignment then column(default alignment of the Column is sap.ui.core.TextAlign.Begin). http://jsbin.com/mujisolo/1/edit

Best regards, Cahit

aborjinik avatar Mar 12 '14 19:03 aborjinik

aborjinik is right.

your proposed solution is also my solution.. does it make sense? shouldn't it be possible individually and directly on the element?

dvorpahl avatar Mar 12 '14 21:03 dvorpahl

Hi dvorpahl,

Table control is not for layouting. Most of the time you get the data from server and you repeat your items template for every record with binding.(e.g. sap.ui.table is not allowed to use without binding) Since this is the most use-case, it does not make sense to set alignment individually. Otherwise you need to set text alignment on the column and on the item too.

What it would make more sense is having a "Inherit" enumeration for "sap.ui.core.TextAlign" and use this value as default(Currently we do not have "Inherit" and default is "Begin"). But we cannot change the default value because of the compatibility.

Regards, Cahit

aborjinik avatar Mar 13 '14 07:03 aborjinik