logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
siobhan  
#1 Posted : Monday, January 19, 2015 11:57:47 AM(UTC)
siobhan

Rank: Member

Groups: Registered
Joined: 6/5/2014(UTC)
Posts: 23
Ireland
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
epf  
#2 Posted : Monday, January 19, 2015 5:07:10 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

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

siobhan  
#3 Posted : Wednesday, January 21, 2015 12:37:05 PM(UTC)
siobhan

Rank: Member

Groups: Registered
Joined: 6/5/2014(UTC)
Posts: 23
Ireland
Location: Dublin

Thanks: 1 times
Thank you,

That's Perfect
Siobhan
CPBOURG  
#4 Posted : Monday, October 1, 2018 12:50:51 PM(UTC)
CPBOURG

Rank: Advanced Member

Groups: Registered
Joined: 9/13/2018(UTC)
Posts: 41
Belgium
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
epf  
#5 Posted : Monday, October 1, 2018 3:36:37 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

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

CPBOURG  
#6 Posted : Friday, October 5, 2018 8:21:58 AM(UTC)
CPBOURG

Rank: Advanced Member

Groups: Registered
Joined: 9/13/2018(UTC)
Posts: 41
Belgium
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
epf  
#7 Posted : Friday, October 5, 2018 1:33:57 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

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.
CPBOURG  
#8 Posted : Friday, October 5, 2018 4:14:27 PM(UTC)
CPBOURG

Rank: Advanced Member

Groups: Registered
Joined: 9/13/2018(UTC)
Posts: 41
Belgium
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
Users browsing this topic
Guest
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.