**Resolved** DataTable Column, need to set colspan=2 in Logi/DMF (not JS or JQuery)
Good afternoon all,
I'm adding a simple reproducer of this issue, but here is the summary:
- I have a DataTable with some Header Rows that span 2 columns (some that span only 1)
- I have DataTable Columns that should all span 2 columns
- I can solve this on the web presentation using javascript/jquery, but the PDF export doesn't include the js, so I lose this setup when using Logi's Action.PDF element.
- Therefore, I need the solution to be part of the native Logi definition, either by DMF or by some attribute or setting that I'm not seeing.
Here is the reproducer with a jquery fix (using 3.5.1) to demonstrate how I would solve this if I didn't need it to work in PDF:
<?xml version="1.0" encoding="utf-8"?>
<Report
ID="TestMultiColumnSingleHeader"
>
<IncludeScriptFile
IncludedScriptFile="jquery-3.5.1.min.js"
/>
<Body>
<DataTable
ID="dt1"
>
<DataLayer
ID="dls1"
Type="Static"
>
<StaticDataRow
value="1"
/>
<AggregateColumn
AggregateColumn="value"
AggregateFunction="Sum"
ID="totValue"
/>
<SequenceColumn
ID="seq"
/>
<AggregateColumn
AggregateColumn="seq"
AggregateFunction="Max"
ID="runValue"
/>
</DataLayer>
<HeaderRow
ID="hdr1"
>
<Column
ColSpan="2"
ID="hdrCol1"
>
<Label
Caption="Double Wide Header"
/>
</Column>
</HeaderRow>
<HeaderRow
ID="hdr2"
>
<Column
ID="hdr2Num"
>
<Label
Caption="#"
/>
</Column>
<Column
ID="hdr2Perc"
>
<Label
Caption="%"
/>
</Column>
</HeaderRow>
<HeaderRow
ID="hdrTot"
>
<Column
ID="hdrTotNum"
>
<Label
Caption="@Data.totValue~"
Format="General Number"
/>
</Column>
<Column
ID="hdrTotPerc"
>
<Label
Caption="=@Data.runValue~/@Data.totValue~"
Format="Percent"
/>
</Column>
</HeaderRow>
<DataTableColumn
Class="ThemeAlignCenter"
ID="dtCol1"
>
<Label
Caption="@Data.value~"
/>
</DataTableColumn>
</DataTable>
<IncludeScript
IncludedScript="$('[id^=dtCol1]').attr('colspan',2);"
/>
</Body>
<ideTestParams/>
</Report>
Thanks,
Johnny
0
-
nvm... I answered my own question in testing. I can remove all colspan attributes from the table and simply split the columns that need splitting using Rows/Columns in Logi. Here is a sample showing both methods, but the first one works for my use case (on web AND in exports):
<?xml version="1.0" encoding="utf-8"?>
<Report
ID="TestMultiColumnSingleHeader"
>
<IncludeScriptFile
IncludedScriptFile="jquery-3.5.1.min.js"
/>
<Body>
<DataTable
ID="dtsingle"
>
<DataLayer
ID="dlssingle"
Type="Static"
>
<StaticDataRow
value="1"
/>
<AggregateColumn
AggregateColumn="value"
AggregateFunction="Sum"
ID="totValue"
/>
<SequenceColumn
ID="seq"
/>
<AggregateColumn
AggregateColumn="seq"
AggregateFunction="Max"
ID="runValue"
/>
</DataLayer>
<HeaderRow
ID="hdr1single"
>
<Column
ID="hdrCol1"
>
<Label
Caption="split w/ Rows-Cols"
/>
</Column>
</HeaderRow>
<HeaderRow
ID="hdr2single"
>
<Column
ID="hdr2col1"
>
<Rows
ID="hdr2rows"
Width="100"
WidthScale="%"
>
<Row
ID="hdr2Row1"
>
<Column
ID="hdr2Num"
Width="50"
WidthScale="%"
>
<Label
Caption="#"
/>
</Column>
<Column
ID="hdr2Perc"
Width="50"
WidthScale="%"
>
<Label
Caption="%"
/>
</Column>
</Row>
</Rows>
</Column>
</HeaderRow>
<HeaderRow
ID="hdrTotsingle"
>
<Column
ID="hdrTotsingleCol1"
>
<Rows
ID="hdr3Rows"
>
<Row
ID="hdr3Row1"
>
<Column
ID="hdrTotNumsingle"
Width="50"
WidthScale="%"
>
<Label
Caption="@Data.totValue~"
Format="General Number"
/>
</Column>
<Column
ID="hdrTotPercsingle"
Width="50"
WidthScale="%"
>
<Label
Caption="=@Data.runValue~/@Data.totValue~"
Format="Percent"
/>
</Column>
</Row>
</Rows>
</Column>
</HeaderRow>
<DataTableColumn
Class="ThemeAlignCenter"
ID="dtCol1single"
>
<Label
Caption="@Data.value~"
/>
</DataTableColumn>
</DataTable>
<DataTable
ID="dtdouble"
>
<DataLayer
ID="dls1"
Type="Static"
>
<StaticDataRow
value="1"
/>
<AggregateColumn
AggregateColumn="value"
AggregateFunction="Sum"
ID="totValue"
/>
<SequenceColumn
ID="seq"
/>
<AggregateColumn
AggregateColumn="seq"
AggregateFunction="Max"
ID="runValue"
/>
</DataLayer>
<HeaderRow
ID="hdr1"
>
<Column
ColSpan="2"
ID="hdrCol1"
>
<Label
Caption="split w/ jQuery"
/>
</Column>
</HeaderRow>
<HeaderRow
ID="hdr2"
>
<Column
ID="hdr2Num"
Width="50"
WidthScale="%"
>
<Label
Caption="#"
/>
</Column>
<Column
ID="hdr2Perc"
Width="50"
WidthScale="%"
>
<Label
Caption="%"
/>
</Column>
</HeaderRow>
<HeaderRow
ID="hdrTot"
>
<Column
ID="hdrTotNum"
>
<Label
Caption="@Data.totValue~"
Format="General Number"
/>
</Column>
<Column
ID="hdrTotPerc"
>
<Label
Caption="=@Data.runValue~/@Data.totValue~"
Format="Percent"
/>
</Column>
</HeaderRow>
<DataTableColumn
Class="ThemeAlignCenter"
ID="dtCol1"
>
<Label
Caption="@Data.value~"
/>
</DataTableColumn>
<Note
Note="Works great for web, but breaks in exports"
/>
</DataTable>
<IncludeScript
IncludedScript="$('[id^=dtCol1]').attr('colspan',2);"
/>
</Body>
<ideTestParams/>
</Report>0
Please sign in to leave a comment.
Comments
1 comment