How to freeze a dynamic selection of rows below header in PrimeNG data table - row

I have managed to freeze header and columns but now need to freeze also a dynamic selection of rows that I want to display right below header.
Here is the current data table html. Please tell me how I can add to it.
<p-table [columns]="store.fields" [value]="playerSeasonStats" [scrollable]="true" [scrollHeight]="tableHeight" frozenWidth="240px">
<ng-template pTemplate="frozencolgroup" let-columns>
<colgroup>
<col style="width:160px">
<col style="width:80px">
</colgroup>
</ng-template>
<ng-template pTemplate="colgroup" let-columns>
<colgroup>
<col style="width:160px">
<col style="width:160px">
<col style="width:80px">
<col style="width:80px">
<col *ngFor="let col of columns" style="width:100px">
</colgroup>
</ng-template>
<ng-template pTemplate="frozenheader">
<tr>
<th style="height:83px" [pSortableColumn]="'player_name'">Name</th>
<th style="height:83px" [pSortableColumn]="'season'">Season</th>
</tr>
</ng-template>
<ng-template pTemplate="frozenbody" let-rowData>
<tr>
<td (click)="toggleAnalyzed(rowData?.player_instatid)">{{rowData['player_name']}}</td>
<td>{{rowData['season']}}</td>
</tr>
</ng-template>
<ng-template pTemplate="header" let-columns>
<tr>
<th [pSortableColumn]="'team_name'">Club</th>
<th [pSortableColumn]="'league_name'">League</th>
<th [pSortableColumn]="'primary_position'">Position</th>
<th [pSortableColumn]="'matches_count'">Matches count</th>
<th *ngFor="let col of columns" [pSortableColumn]="col">
{{capitalizeField(col)}}
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr>
<td>{{rowData['team_name']}}</td>
<td>{{rowData['league_name']}}</td>
<td>{{rowData['primary_position']}}</td>
<td>{{rowData['matches_count']}}</td>
<td *ngFor="let col of columns" [ngClass]="colorCondition(rowData, col)">
{{rowData[col]}}
</td>
</tr>
</ng-template>
</p-table>

Related

Show a List of value vertically in jsp page

<table class="table">
<thead>
<tr>
<th scope="col">Book Id</th>
<th scope="col">Book Name</th>
<th scope="col">Book Author</th>
</tr>
</thead>
<tbody>
<tr>
<td><c:forEach items="${searchedBook}" var="book">
${book.book_id}
</c:forEach></td>
</tr>
<tr>
<td><c:forEach items="${searchedBook}" var="book">
${book.book_name}
</c:forEach></td>
</tr>
<tr>
<td><c:forEach items="${searchedBook}" var="book">
${book.book_author}
</c:forEach></td>
</tr>
</tbody>
</table>
how the table looks like now
but how I want it is like this,
the way I want it to look like
Is there a way to make it possible?
You declare forEach loop inside <td> tag it print all data in single <td>
Here down modified code:
<table class="table">
<thead>
<tr>
<th scope="col">Book Id</th>
<th scope="col">Book Name</th>
<th scope="col">Book Author</th>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${searchedBook}" var="book">
<td>${book.book_id}</td>
</c:forEach>
</tr>
<tr>
<c:forEach items="${searchedBook}" var="book">
<td>${book.book_name}</td>
</c:forEach>
</tr>
<tr>
<c:forEach items="${searchedBook}" var="book">
<td>${book.book_author}</td>
</c:forEach>
</tr>
</tbody>
</table>

Graphviz/ Table/ How to merge cells

I would like to draw a graph like this -
I have Graphviz code like this -
digraph G {
"test" [
label = <<table border="0" cellspacing="0">
<tr>
<td port="f0" border="1" bgcolor="darkorange">TEST</td>
<td port="f1" border="1" bgcolor="darkorange"></td>
</tr>
<tr>
<td port="f2" border="1" bgcolor="cyan">A</td>
<td>
<table border="0" cellspacing="0">
<tr><td port="f3" border="1" bgcolor="azure">A1</td></tr>
<tr><td port="f4" border="1" bgcolor="azure">A2</td></tr>
<tr><td port="f5" border="1" bgcolor="azure">A3</td></tr>
</table>
</td>
</tr>
<tr>
<td port="f5" border="1" bgcolor="gray">Else</td>
<td port="f6" border="1" bgcolor="gray"></td>
</tr>
</table>>
shape = "none"
];
}
But it gives the graph like this
Would you please suggest how can we tweak the code to achieve the objective - merging f0, f1 on top and f5,f6 at bottom?
You can use HTML <td>s with colspan and rowspan attributes in GraphViz. These allow one cell to span multiple columns and/or rows inside a table.
This also simplifies your digraph, as only one table is needed.
digraph G {
"test" [
label = <<table border="0" cellspacing="0">
<tr>
<td colspan="2" port="f0" border="1" bgcolor="darkorange">TEST</td>
</tr>
<tr>
<td rowspan="3" port="f5" border="1" bgcolor="blue">A</td>
<td port="f6" border="1" bgcolor="white">A1</td>
</tr>
<tr>
<td port="f6" border="1" bgcolor="white">A2</td>
</tr>
<tr>
<td port="f6" border="1" bgcolor="white">A3</td>
</tr>
<tr>
<td colspan="2" port="f0" border="1" bgcolor="grey">Else</td>
</tr>
</table>>
shape = "none"
];
}
This gives you the following basic output, which you can then customize for spacing, line colors, etc:
This one also works. what's is the difference?
digraph G {
"test" [
label = <<table border="0" cellspacing="0">
<tr><td colspan="2" port="f0" border="1" bgcolor="darkorange">TEST</td> </tr>
<tr><td rowspan="4" port="f5" border="1" bgcolor="blue">A</td></tr>
<tr><td port="f6" border="1" bgcolor="white">A1</td></tr>
<tr><td port="f6" border="1" bgcolor="white">A2</td></tr>
<tr><td port="f6" border="1" bgcolor="white">A3</td></tr>
<tr><td colspan="2" port="f0" border="1" bgcolor="grey">Else</td></tr>
</table>>
shape = "none"
];
}

ColdFusion Exporting to Excel

I have a Excel filte that was exported from ColdFusion data. My question is do we have an option to move U & V column cells to the left of column B using ColdFusion. Here my code below :
<cfheader name="Content-Disposition" value="attachment; filename=Reporting.xls">
<cfcontent type="application/vnd.ms-excel">
<table cellspacing="1" border="0">
<thead>
<tr>
<th colspan="3" style="border-style:none;"> </th>
<th class="cellSpacer"> </th>
<th colspan="7" class="colorHeader">Major Maintenance Expenditure ($k)</th>
<th class="cellSpacer"> </th>
<th colspan="7" class="colorHeader">Capital Expenditure ($k)</th>
<th class="cellSpacer"> </th>
<th colspan="7" class="colorHeader">Asset Retirement Obligations ($k)</th>
<th class="cellSpacer"> </th>
<th colspan="7" class="colorHeader">Environmental Liability ($k)</th>
<th class="cellSpacer"> </th>
</tr>
<cfoutput query="Myqry">
<tr>
<td>#Myquery.columns1#</td>
</tr>
</cfoutput>
</table>
I recommend looking into <cfspreadsheet> https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-r-s/cfspreadsheet.html

Sublist in Netsuite PDF/HTML Template

I have a credit memo template for which I want to include what invoices this credit has been applied to (This information is in a sublist on the record under ITEM > Apply )
I currently have the below code in the template, which only seems to show the first invoice in the sublist?? I can't figure why.
<#if record.apply?has_content>
<table>
<thead><tr><th>Applied to:</th></tr></thead></table>
<table><#list record.apply as apply><#if apply_index==3>
<thead>
<tr>
<th style="align: center;">Date</th>
<th style="align: center;">Invoice</th>
<th style="align: center;">Original Amount</th>
<th style="align: center;">Payment</th>
<th style="align: center;">Due</th>
</tr>
</thead><tr>
<td style="align: center;">${apply.duedate}</td>
<td style="align: center;">${apply.refnum}</td>
<td style="align: center;">${apply.total}</td>
<td style="align: center;">${apply.amount}</td>
<td style="align: center;"><#assign remaining=(apply.total)-(apply.amount)>${remaining?string.currency}</td>
</tr></#if></#list>
</table></#if>
I don't have access to any suitescript or serverscript or anything like that, so I need a solution to the source code in the PDF/HTML Template (if possible)
You have <#if apply_index==3>, this is only ever true once. It should be <#if apply_index==0> and that should end after defining the thead.
The rest of the list loop should be as is. The problem is your if statement. It's typically used to only create the header at index 0. The rest of the tbody is produced outside of the if statement and inside the list loop.
Since your header is 100% static typed, you do not need the if statement at all. You should only have the TR sections within the TBODY within your list loop.
<#if record.apply?has_content>
<table>
<thead><tr><th>Applied to:</th></tr></thead></table>
<table>
<thead>
<tr>
<th style="align: center;">Date</th>
<th style="align: center;">Invoice</th>
<th style="align: center;">Original Amount</th>
<th style="align: center;">Payment</th>
<th style="align: center;">Due</th>
</tr>
</thead>
<tbody>
<#list record.apply as apply>
<tr>
<td style="align: center;">${apply.duedate}</td>
<td style="align: center;">${apply.refnum}</td>
<td style="align: center;">${apply.total}</td>
<td style="align: center;">${apply.amount}</td>
<td style="align: center;"><#assign remaining=(apply.total)-(apply.amount)>${remaining?string.currency}</td>
</tr>
</#list>
</tbody>
</table>
</#if>

Linux (sed|PCRE|grep) Regular expression to isoloate XML (KML) style data conditionally

Updates after sample code.
Solution: as provided by BeniBela He figured out what I failed to make clear...It has to be command line, not necessarily regex, and offered up this solution:
xpath -e '//Placemark[contains(description, "Iron")]'
as promised:
|
( )
/ \
_______
| _ |
| | | | All must enter and pay homage! (Shrine of BeniBela)
Problem: I need some form of command line regex to accomplish the following: Detect in one file of a set of Placemarks, Placemarks which include a keyword (in this case Iron) in a contained CDATA tag. without grabbing Placemarks which do not have the keywod. (All data from <Placemark> to </Placemark> needs to be captured.)
Explanation:
Two code samples are given below, one showing three full placemarks, two of which are useless to me, the third of which I want. The second code sample shows just the one I am interested in.
I need to extract the valid Placemark from the data file (which contains hundreds of placemarks) and append it into another file. I will then merge this file into a properly formatted KML later. The data sets are from the US Geological Survey and are very large.
The idea here is to recover placemarks for mines which are extracting a given kind of Ore (Iron for this example), and create a specialized KML (Keyhole Markup Language) file for display in a Google Earth type application.
sample1 (Multiple data with one valid entry):
<Placemark>
<name>
Las Antos Prospect</name>
<Snippet>
Record 10005251</Snippet>
<description>
<![CDATA[<p>
Record <a href="http://mrdata.usgs.gov/mrds/show.php?labno=10005251">
10005251</a>
of the <a href="http://mrdata.usgs.gov/mrds/">
Mineral Resources Data System</a>
</p>
<table border='1' padding='3' cellspacing='0'>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
oper_type</th>
<td>
Unknown</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
dev_stat</th>
<td>
Occurrence</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
ore</th>
<td>
Limestone</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
model</th>
<td>
</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod1</th>
<td>
Limestone, General</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod2</th>
<td>
</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod3</th>
<td>
</td>
</tr>
</table>
]]>
</description>
<styleUrl>
#defaultStyleMap</styleUrl>
<Point>
<altitudeMode>
relativeToGround</altitudeMode>
<coordinates>
-64.88273,-24.87527,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>
Unnamed Occurence</name>
<Snippet>
Record 10005252</Snippet>
<description>
<![CDATA[<p>
Record <a href="http://mrdata.usgs.gov/mrds/show.php?labno=10005252">
10005252</a>
of the <a href="http://mrdata.usgs.gov/mrds/">
Mineral Resources Data System</a>
</p>
<table border='1' padding='3' cellspacing='0'>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
oper_type</th>
<td>
Unknown</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
dev_stat</th>
<td>
Occurrence</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
ore</th>
<td>
</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
model</th>
<td>
</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod1</th>
<td>
Iron</td> ######################Iron here makes it valid
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod2</th>
<td>
</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod3</th>
<td>
</td>
</tr>
</table>
]]>
</description>
<styleUrl>
#defaultStyleMap</styleUrl>
<Point>
<altitudeMode>
relativeToGround</altitudeMode>
<coordinates>
-64.81607,-24.67527,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>
Merced I Quarry</name>
<Snippet>
Record 10005254</Snippet>
<description>
<![CDATA[<p>
Record <a href="http://mrdata.usgs.gov/mrds/show.php?labno=10005254">
10005254</a>
of the <a href="http://mrdata.usgs.gov/mrds/">
Mineral Resources Data System</a>
</p>
<table border='1' padding='3' cellspacing='0'>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
oper_type</th>
<td>
Unknown</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
dev_stat</th>
<td>
Producer</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
ore</th>
<td>
Limestone</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
model</th>
<td>
</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod1</th>
<td>
Limestone, General</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod2</th>
<td>
</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod3</th>
<td>
</td>
</tr>
</table>
]]>
</description>
<styleUrl>
#ProducerStyleMap</styleUrl>
<Point>
<altitudeMode>
relativeToGround</altitudeMode>
<coordinates>
-65.46052,-24.9586,0</coordinates>
</Point>
</Placemark>
The above sample contains two Placemarks which I have no use for, bracketing one which I need to extract.
Sample 2 (Showing just a 'valid' entry):
(The capture would need to grab all of this)
<Placemark>
<name>
Unnamed Occurence</name>
<Snippet>
Record 10005252</Snippet>
<description>
<![CDATA[<p>
Record <a href="http://mrdata.usgs.gov/mrds/show.php?labno=10005252">
10005252</a>
of the <a href="http://mrdata.usgs.gov/mrds/">
Mineral Resources Data System</a>
</p>
<table border='1' padding='3' cellspacing='0'>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
oper_type</th>
<td>
Unknown</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
dev_stat</th>
<td>
Occurrence</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
ore</th>
<td>
</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
model</th>
<td>
</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod1</th>
<td>
Iron</td> ######################Iron here makes it valid
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod2</th>
<td>
</td>
</tr>
<tr valign='top'>
<th align='right' bgcolor='#ddffee'>
commod3</th>
<td>
</td>
</tr>
</table>
]]>
</description>
<styleUrl>
#defaultStyleMap</styleUrl>
<Point>
<altitudeMode>
relativeToGround</altitudeMode>
<coordinates>
-64.81607,-24.67527,0</coordinates>
</Point>
</Placemark>
Update 1:
I got this to work in a regex tester, but I am still working on how to get it into grep et.al.
<Placemark>\n<name>\n.*</name>\n<Snippet>\n.*\n<description>\n(?:(?:.*\n){48}.*Iron.*\n|(?:.*\n){41}.*Iron.*\n|(?:.*\n){35}.*Iron.*\n)(?:.*\n){3,16}\]\]>\n</description>\n(?:.*\n){8,12}</Placemark>
That is trivial with XPath instead regex:
/Placemark[contains(description, "Iron")]
(or /*/Placemark[contains(description, "Iron")] if your xml contains a (required) root element)