Get KoolPHP UI with 30% OFF!

Possible templates for Field's property "FormatString"

Martin
All examples show "{n}" as the only template for the field's "FormatString" property. Are there any others? How do I make right aligned numbers? I tried to use this pattern:
$field->FormatString = "<span style='text-align:right;display:block;'>{n}</span>";

It does the job; all values are right-aligned, except zero'es or NULL values that appear as left-aligned dash "-" in the grid. Is there a better way to provide right aligned values?
Thanks.
Posted Oct 2, 2015 Kool
Peter
Hi Martin,
You can use the
  $col = new GridBoundColumn;
  $col->CssClass="right-align";
  ...

.. and this css class will apply to the cell of that column.
Regards,
Peter
Posted Oct 3, 2015 Kool -
Martin
Hi Peter,
I'm talking about Pivot table (KoolPivotTable class) where columns are added by this:
$pivot->AddColumnField($field);

where field is an instance of PivotField class or descendants. Are we talking about the same? If yes, can you give me a full example of how creation the field?
Thank you.
Martin
Posted Oct 5, 2015 Kool
David
Hi Martin,
If you only want to right-align the content of the data cell, please add the following CSS rule to the style file or in-page style:
.kptDataCell {
  text-align: right;
}

Hope this helps!
Rgds,
Posted Oct 7, 2015 , edited Oct 7, 2015 Kool
Martin
Hi David,
OK. That helps when you have one Pivot table on a single page. So the alignment is not supported on the 'template' level. There is no pattern like '{n:right}'; which you could use in the FormatString property. We have to deal with Stylesheets. Is it the right understanding? What other patterns, other than '{n}', are supported in the PivotField::FormatString property?
Best Regards,
Martin
Posted Oct 7, 2015 Kool
David
Hi Martin,
"{n}" is the only place holder to be replaced in the FormatString property. Regarding your request, in the next release of KoolPivotTable middle this month we would add some feature to allow you to customize the template of the data cells.
Rgds,
Posted Oct 7, 2015 Kool
Martin
Thank you, David. If you implement right-aligning of data fields on the pattern level then oyu may also consider aligning the column names in the Header accordingly.
Best Regards,
Martin
Posted Oct 7, 2015 , edited Oct 7, 2015 Kool
Josh
If you want to start a successful career in Germany, but it’s hard for you to start your journey, because finding a job in another country is fraught with a number of difficulties - it doesn’t matter, because this thematic resource click this link will allow you to more easily join the desired company and take the best position!
Posted Aug 27, 2023 Kool