Rank: Member
Groups: Registered
Joined: 6/5/2014(UTC) Posts: 23 Location: Dublin Thanks: 1 times
|
Hi.
In my Data Table I have some Columns which are Data Drop Elements which Totals the columns on my Data table.
Can I have that result centered on the data table rather than right Aligned.
Also is it possible to customize individual columns centered and some right aligned.
Thanks, Siobhan
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Hi, You can control the cell style in your table by doing this: Select your element in the Model, then click the Advanced->Custom Cell CSS property This property allows you to customize the CSS of the cell, thus if you want to align center, just enter text-align:right; There are several samples provided in the editor. For numeric values, up to 3 CSS strings can be specified separated by '|'. The first CSS is applied by default, the second CSS is for empty or zero values, the third CSS string is for the negative values. This allow for example to display your negative values in red. I hope it helps. Edited by user Monday, January 19, 2015 5:08:11 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Registered
Joined: 6/5/2014(UTC) Posts: 23 Location: Dublin Thanks: 1 times
|
Thank you,
That's Perfect Siobhan
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 9/13/2018(UTC) Posts: 41 Location: Ottignies Was thanked: 2 time(s) in 2 post(s)
|
Hello,
I applied this for one report, and this indeed works fine.
The only point, is that I would like to be able to apply this to all reports, meaning, is it possible to apply this somewhere as default value?
Thanks ! Thomas
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
You have many ways to do it. You can modify the DataTable.cshtml view template to force a css class or style during the generation. In general, you can always change your default values using the InitScript of the reports. You can defined this using the Server Manager then Configuration->Configure Server->Init Script property. If you want to use the CellScript to do this, you can initialize all CellScript of your Data elements using this init script: Code:@using Seal.Model
@{
Report report = Model;
foreach (var model in report.Models) {
foreach (var element in model.Elements.Where(i => i.PivotPosition == PivotPosition.Data)) {
element.CellScript = @"@using Seal.Model
@{
ResultCell cell=Model;
cell.FinalCssStyle = ""font-weight:bold;"";
cell.FinalCssClass = ""danger lead text-center""; //These are Bootstrap classes
}";
}
}
}
This script configures a script used at execution... In attachment is my test report on Northwind: test init script for cell script.srex (8kb) downloaded 3 time(s).Edited by user Monday, October 1, 2018 3:38:00 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 9/13/2018(UTC) Posts: 41 Location: Ottignies Was thanked: 2 time(s) in 2 post(s)
|
Hello Eric,
Thanks, this works indeed for value cells, they are all centered now using :
@using Seal.Model @{ Report report = Model; foreach (var model in report.Models) { foreach (var element in model.Elements.Where(i => i.PivotPosition == PivotPosition.Data)) { element.CellScript = @"@using Seal.Model @{ ResultCell cell=Model; cell.FinalCssStyle = ""text-align:center;""; cell.FinalCssClass = ""text-center""; //These are Bootstrap classes }"; } } }
Can I apply the same for the Column header? (but where?)
Best regards Thomas
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
The column headers depends on the cross table defined in your model...
If you have defined row and columns, then the column headers comes from the column names and values If you have defined only row, then the column headers comes form the data name...
So it is not so simple... You can use the following flags in your cell script: cell.IsTotal indicates if it is a total cell cell.IsTotalTotal indicates if it is a total of total cell cell.IsSubTotal indicates if it is a sub-total cell cell.IsTitle indicates if it is a title cell Check cell script sample for more options.
The other approach is to modify the view template DataTable.cshtml and to change the html generation by setting class="text-center" where you wish.
Good luck.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 9/13/2018(UTC) Posts: 41 Location: Ottignies Was thanked: 2 time(s) in 2 post(s)
|
Great!
I used the DataTable.cshtml approach, and indeed all is centered now when using PivotTables.
Many Thanks! Thomas
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.