If I have 10 columns in a Spark datagrid, and some headers need to be left-justified, some headers right-justified, and some centered, what’s the simplest way to accomplish this?
Assuming a custom headerRenderer is needed, are there any simple examples that can walk me through it?
Thanks in advance for any comments.
The simplest way I could find to solve this is to override the settings in the spark DefaultGridHeaderRenderer, as discussed in this link:
http://flexponential.com/2011/10/30/changing-fontweight-of-spark-datagrid-headers/
More specifically, I used the following custom headerRenderer, saved as file: myRightHeaderRenderer.mxml:
This custom header renderer right-justifies header text. To use it, simply add it to one or more columns of the Spark DataGrid as follows:
I’m not sure how to do it, but I’m sure it can be made more flexible by parameterizing the textAlign attribute to be
center,left, orright.