How to iterate a map on XHTML pages? - jsf

I have a list like below
List<Map<String,List<ActivitiesData>>>
When I tried to iterate map in xhtml page I am able to get the List<ActivitiesData> values but I am unable to get the key(String) from map
The code is like below.
<ui:repeat var="timelineDateMapObject" value="#{timelineBean.timelineList}">
<ui:repeat value="#{timelineDateMapObject.keySet().toArray()}" var="x">
<ui:repeat var="timelineData" value="#{timelineDateMapObject.get(x)}" varStatus="status">
<tr>
<td style="padding-right: 10px;padding-left: 20px;"> #{timelineData.hoursAndMiniuts}</td>
<td style="padding-right: 10px;padding-left: 20px;"> #{timelineData.type}</td>
</tr>
<tr>
<td style="padding-right: 10px;padding-left: 20px;">
<h:graphicImage style="height: 50px; width: 50px" value="#{timelineData.url}" />
</td>
<td style="padding-right: 10px;padding-left: 20px;">#{timelineData.text}</td>
</tr>
<tr>
<td height="25px"></td>
<td></td>
</tr>
</ui:repeat>
</ui:repeat>
</ui:repeat>
Anyone please tell me how can I display key from map?

Try this
<ui:repeat var="timelineDateMapObject" value="#{timelineBean.timelineList}">
<c:forEach items="#{timelineDateMapObject}" var="timelineData">
<tr>
<td style="padding-right: 10px;padding-left: 20px;"> #{timelineData.value.hoursAndMiniuts}</td>
<td style="padding-right: 10px;padding-left: 20px;"> #{timelineData.value.type}</td>
</tr>
<tr>
<td style="padding-right: 10px;padding-left: 20px;">
<h:graphicImage style="height: 50px; width: 50px" value="#{timelineData.value.url}" />
</td>
<td style="padding-right: 10px;padding-left: 20px;">#{timelineData.value.text}</td>
</tr>
<tr>
<td height="25px"></td>
<td></td>
</tr>
</c:forEach>
</ui:repeat>

Related

How to add a button inside of 1 cell inside a table on SharePoint?

I'm trying to add a button that links out to another website inside of a cell in SharePoint but it keeps moving the button to either above or below the table and not inside of the cell.
Is it possible to do this with either an embed code or an HTML code that I could place within "Edit Source" under "Content Editor"?
Any help on this would be appreciated. I have been researching solutions all day.
The below is currently what is being used. Am I doing something wrong?
<span style="font-size: 10px;">
<font face="Verdana">
<a href="/sites/Global_OE/SitePages/Forms/ByAuthor.aspx">
<strong>
<input name="HONDA" type="button" value="Case for Change & Sponsorship " style="background-color: #336699; color: #ffffff;"/>
</strong>
</a>
</font>
</span>
<table cellspacing="0" width="100%" class="ms-rteTable-default">
<tbody>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">​<br/>​<br/></td>
<td class="ms-rteTableOddCol-default" style="width: 20%; text-align: center;">
<style="background-color: style="font-family: optima;">​<img src="/sites/Global_OE/homepagedraft/SiteAssets/SitePages/Test/Picture1.png" alt="Picture1.png" style="margin: 5px; width: 25px; height: 25px;"/><span class="ms-rteFontSize-4">Diagn​​ose & Scope</span>​<br/></style="background-color:></td>
<td class="ms-rteTableEvenCol-default" style="width: 20%;">
</td>
<td class="ms-rteTableOddCol-default" style="width: 20%;">
</td>
<td class="ms-rteTableEvenCol-default" style="width: 20%;">
</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">
</td>
<td class="ms-rteTableOddCol-default">
<p>
<span style="font-family: optima;">•Align to the business strategy</span></p>
<p>
<span style="font-family: optima;">•Align on what success looks like with leader and/ or sponsor</span></p>
</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">
<div>​OE </div>
<div> Getting Started & Tracking Progress<br/></div>
</td>
<td class="ms-rteTableOddCol-default">​​​​​​​​​​<br/></td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​Change Management<sup>3
<br/></sup>(Complex Change)<br/></td>
<td class="ms-rteTableOddCol-default">​<br/></td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​Organization Design<br/></td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">
<div style="text-align: center;">​Everyday Change </div>
<div style="text-align: center;">(Team Effectiveness)<br/></div>
</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​​Process Enablement<br/></td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
</tbody>
</table>
The following code for your reference.
<table cellspacing="0" width="100%" class="ms-rteTable-default">
<tbody>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">​
<span style="font-size: 10px;">
<font face="Verdana">
<a href="/sites/Global_OE/SitePages/Forms/ByAuthor.aspx">
<strong>
<input name="HONDA" type="button" value="Case for Change & Sponsorship" onclick="window.location.href='/sites/Global_OE/SitePages/Forms/ByAuthor.aspx'" style="background-color: #336699; color: #ffffff;"/>
</strong>
</a>
</font>
</span>
</td>
<td class="ms-rteTableOddCol-default" style="width: 20%; text-align: center;">
<style="background-color: style="font-family: optima;">​<img src="/sites/Global_OE/homepagedraft/SiteAssets/SitePages/Test/Picture1.png" alt="Picture1.png" style="margin: 5px; width: 25px; height: 25px;"/><span class="ms-rteFontSize-4">Diagn​​ose & Scope</span>​<br/></style="background-color:></td>
<td class="ms-rteTableEvenCol-default" style="width: 20%;">
</td>
<td class="ms-rteTableOddCol-default" style="width: 20%;">
</td>
<td class="ms-rteTableEvenCol-default" style="width: 20%;">
</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">
</td>
<td class="ms-rteTableOddCol-default">
<p>
<span style="font-family: optima;">•Align to the business strategy</span></p>
<p>
<span style="font-family: optima;">•Align on what success looks like with leader and/ or sponsor</span></p>
</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">
<div>​OE </div>
<div> Getting Started & Tracking Progress<br/></div>
</td>
<td class="ms-rteTableOddCol-default">​​​​​​​​​​<br/></td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​Change Management<sup>3
<br/></sup>(Complex Change)<br/></td>
<td class="ms-rteTableOddCol-default">​<br/></td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​Organization Design<br/></td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">
<div style="text-align: center;">​Everyday Change </div>
<div style="text-align: center;">(Team Effectiveness)<br/></div>
</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​​Process Enablement<br/></td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
</tbody>
</table>

Is that some tips to write dustjs template for faster render? node.js

I use dustjs to render my mail content and I found that it's slow when render some bigger templates. Is any tips when write dustjs template to increase the render speed, or some good practice?
details:
my template consists of several components (more than 5), each component if different from others, there is one example of the component as follow:
<tr>
<td align="center" valign="top" bgcolor="#FFFFFF">
<table cellpadding="0" cellspacing="0" width="650">
<tr>
<td align="center">
<table width="590" border="0" cellspacing="0" cellpadding="0">
{#eq key=haveBanner value=1}
<tr>
<td height="105" align="center" valign="middle">
<img src="{bannerUrl|pictureUrl}" width="590" border="0">
</td>
</tr>
{:else}
<tr>
<td align="center">
<table cellpadding="0" cellspacing="0" width="590" height="75" style="border-top:solid 3px #343434">
<tr>
<td width="130" align="left" valign="middle">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" height="55">
<img src="{sellerLogo|pictureUrl}" width="110" height="55">
</td>
</tr>
</table>
</td>
<td width="460" align="left">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><font style="font-family:arial;font-size:16px;color:#292929">{compName}</strong></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
{/eq}
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" style="border:solid 1px #dbdbdb" width="594">
<tr>
<td width="149" valign="top" style="border-right:solid 1px #dbdbdb">
<table width="146" cellspacing="0" cellpadding="0">
<tr>
{#eq key=selectedProductFlag value=1}
<td height="80" style="padding:20px 20px"><font style="font-family:arial;font-size:18px;color:#333333"><b>Promotion Products</b></font></td>
{:else}
<td height="80" style="padding:20px 20px"><font style="font-family:arial;font-size:18px;color:#333333"><b>Promotion Products</b></font></td>
{/eq}
</tr>
<tr>
<td align="center" height="26" valign="top">
<table width="119" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="border-top:solid 1px #e5e5e5"><img src="http://newimg.globalmarket.com/PA/edm/images/spacer.gif" height="1" width="1"></td>
</tr>
</table>
</td>
</tr>
{#finalProdGroupList}
<tr>
<td height="35" valign="top">
<table width="146" cellspacing="0" cellpadding="0">
<tr>
<td style="padding-left:25px"><font style="font-family:arial;font-size:12px;color:#484848">{prodGroupName}</font></td>
</tr>
</table>
</td>
</tr>
{/finalProdGroupList}
</table>
</td>
<td width="443" valign="top">
<table width="442" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="442" border="0" cellspacing="0" cellpadding="0" height="255">
<tr>
{#secondaryProducts}
{#productList spIdx=$idx}
{#eq key=$idx value=2}
<td align="center" valign="top" width="147">
{:else}
<td align="center" valign="top" style="border-right:solid 1px #dbdbdb" width="147">
{/eq}
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="146" align="center">
<img src="{photoUrl|pictureUrl}" border="0" width="126" height="126" alt="{fullProdName}">
</td>
</tr>
<tr>
<td align="center">
<table width="126" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<table cellpadding="0" cellspacing="0" width="126">
<tr>
<td align="left" height="33" valign="top" style="line-height:15px">
<font style="font-family:Arial;font-size:12px;color:#333333">{productName}</font>
</td>
</tr>
<tr>
<td align="left" height="20" valign="middle"><font style="font-family:Arial;font-size:12px;color:#999999">{certification}</font></td>
</tr>
<tr>
{#eq key=payForInqFlag value=1}
<td align="left" height="35" valign="middle"><img src="http://newimg.globalmarket.com/PA/edm/images/getprice2.png" width="128" height="25"></td>
{:else}
<td align="left" height="35" valign="middle"><img src="http://newimg.globalmarket.com/PA/edm/images/getprice2.png" width="128" height="25"></td>
{/eq}
</tr>
<tr>
<td height="7"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
{/productList}
{/secondaryProducts}
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
Your problem is very likely the large amount of Dust filters you are using.
Example:
&{trackCodeData|gaTrackCode|dbTrackCode|entityId|entityType|edmpid|recId|userId|token|final}
Some of these filters are even being run in a loop. It looks like you are running well over 100 filters per render of this template. Filters are executed synchronously and serially, so Dust can't continue to render the template until the filter is done.
Without knowing what these filters do, it's hard to make specific recommendations about the filters themselves. However, you seem to use the same filters multiple times to output the same data. If possible, you should pregenerate this data and add it into the context instead of dynamically generating it.
You can gain a few more cycles by turning on whitespace compression, if you have it turned off:
dust.config.whitespace = false;
But Dust intrinsically is very fast. Without your filters, your template renders in around 3ms for me.

How to pass product TVs to SimpleCart's scGetCart snippet?

I need some TVs (weight, dimensions, etc) I've associated with my products to appear in the Cart page of my SimpleCart site.
Problem is I have no idea how to do this. I don't understand how the SimpleCart cart is built and there isn't documentation for this.
Would anyone know how I can show TVs associated with each product in the cart output chunk?
The cart snippet has the following code which gets data from the cart and puts it into Chunks:
$sc = $modx->getService('simplecart','SimpleCart',$modx->getOption('simplecart.core_path',null,$modx->getOption('core_path').'components/simplecart/').'model/simplecart/',$scriptProperties);
if (!($sc instanceof SimpleCart)) return '';
 
$controller = $sc->loadController('Cart');
$output = $controller->run($scriptProperties);
The output Chunk looks like:
<div id="simplecart">
<form action="[[~[[*id]]]]" method="post" id="form_cartoverview">
<input type="hidden" name="updatecart" value="true" />
<table>
<tr>
<th class="desc">[[%simplecart.cart.description]]</th>
<th class="price">[[%simplecart.cart.price]]</th>
<th class="quantity">[[%simplecart.cart.quantity]]</th>
[[+cart.total.vat_total:notempty=`<th class="quantity">[[%simplecart.cart.vat]]</th>`:isempty=``]]
<th class="subtotal">[[%simplecart.cart.subtotal]]</th>
<th> </th>
</tr>
[[+cart.wrapper]]
[[+cart.total.discount:notempty=`<tr class="total first discount">
<td colspan="[[+cart.total.vat_total:notempty=`3`:isempty=`2`]]"> </td>
<td class="label">[[%simplecart.cart.discount]]</td>
<td class="value">- [[+cart.total.discount_formatted]]</td>
<td class="extra">[[+cart.total.discount_percent:notempty=`([[+cart.total.discount_percent]]%)`:isempty=` `]]</td>
</tr>`:isempty=``]]
[[+cart.total.vat_total:notempty=`
<tr class="total [[+cart.total.discount:notempty=`second`:isempty=`first`]]">
<td colspan="3"> </td>
<td class="label">[[%simplecart.cart.total_ex_vat]]</td>
<td class="value">[[+cart.total.price_ex_vat_formatted]]</td>
<td class="extra"> </td>
</tr>
[[+cart.vat_rates]]
<tr class="total [[+cart.total.discount:notempty=`third`:isempty=`second`]]">
<td colspan="3"> </td>
<td class="label">[[%simplecart.cart.total_vat]]</td>
<td class="value">[[+cart.total.vat_total_formatted]]</td>
<td class="extra"> </td>
</tr>
<tr class="total [[+cart.total.discount:notempty=`fourth`:isempty=`third`]]">
<td colspan="3"> </td>
<td class="label">[[%simplecart.cart.total_in_vat]]</td>
<td class="value">[[+cart.total.price_formatted]]</td>
<td class="extra"> </td>
</tr>
`:isempty=`
<tr class="total [[+cart.total.discount:notempty=`second`:isempty=`first`]]">
<td colspan="2"> </td>
<td class="label">[[%simplecart.cart.total]]</td>
<td class="value">[[+cart.total.price_formatted]]</td>
<td class="extra"> </td>
</tr>
`]]
</table>
<div class="submit">
<input type="submit" value="[[%simplecart.cart.update]]" />
</div>
</form>
This does appear to be documented:
Product Options (TVs)
and to output them:
Modifying the Product Template
It appears that you would just output them normally [[*myProductOptions]]
Though, it appears that your template is using a placeholder, I would try
[[+cart.myProductOptions] as well. If all else fails you might try debugging the simplecart class and dump the array of product data before it populates the chunk, there might be a clue in there.
Found (through trial and error) you must use:
[[+product.tv.name_of_tv]]

How can i create this table example with Primefaces p:dataTable?

I have a table in JSF Page:
<table cellpadding="0" cellspacing="0" border="1" align="center">
<col width="300"/>
<col width="150"/>
<col width="150" span="3"/>
<thead>
<tr>
<th rowspan="3" > </th>
<th rowspan="3" >A</th>
<th colspan="3" >B</th>
</tr>
<tr>
<th colspan="2">C</th>
<th rowspan="2">D</th>
</tr>
<tr>
<th>E</th>
<th>F</th>
</tr>
</thead>
<tbody>
<c:forEach items="${indexbean.regions}" var="r">
<tr>
<td colspan="5" >#{r.region}</td>
</tr>
<c:forEach items="${indexbean.table_data}" var="s">
<c:if test="${s.reg eq r.region}">
<tr>
<td>#{s.rowname}</td>
<td>#{s.d1}</td>
<td>#{s.d2}</td>
<td>#{s.d3}</td>
<td>#{s.d4}</td>
</tr>
</c:if>
</c:forEach>
</c:forEach>
</tbody>
</table>
These codes work properly. But i want to use primefaces p:dataExporter (for download this table as Excel), that is why i must create this table with p:dataTable. I can't find solution what i can replace 2 forEach method in p:dataTable.
How can i create this table with Primefaces p:dataTable? Please, help me.

cellSpace not working in DreamWeaver CS6

I've pasted table code to new div in gridContainer div (using the Fluid Grid Layout option)
Everything seems fine but the cell spacing defined, when I try to change the spacing nothing happens, it keeps it on 0.
Following is the table markup:
<table align="center" cellpadding="0" cellspacing="15">
<col span="7" width="160px" />
<row span="7" width="160px" />
<!---Row 1--->
<tr align="center" height="160px">
<td colspan="2" >
<img src="images/buttons/Optimus.png" />
</td>
<td colspan="2" >
<img src="images/buttons/MapleSim.png">
</td>
<td colspan="2" >
</td>
<td colspan="1" bgcolor="#40b040">
<img src="images/buttons/about_us.png">
</td>
</tr>
<!---Row 2--->
<tr align="center" height="160px">
<td colspan="2" bgcolor="#40b040">
<img src="images/buttons/QFD.white.png">
</td>
<td colspan="1" bgcolor="#cc00cc">
<img src="images/buttons/learning_maple.png">
</td>
<td colspan="3" rowspan="2"
align="left" valign="top" bgcolor="#aaaaff">
<img src="images/buttons/news.png">
News will be shown here
</td>
<td colspan="1" bgcolor="#ff0000">
<img src="images/buttons/services.png">
</td>
</tr>
<!---Row 3--->
<tr align="center" height="160px">
<td colspan="1" bgcolor="#6766cc">
<img src="images/buttons/events.png">
</td>
<td colspan="1" bgcolor="#cccc00">
<img src="images/buttons/forum.png">
</td>
<td colspan="1" bgcolor="#4040ff">
<img src="images/buttons/links.png">
</td>
<td colspan="1" bgcolor="#ffbf00">
<img src="images/buttons/shopping_cart.png">
</td>
</tr>
<!---Row 4--->
<tr align="center" height="160px">
<td colspan="2" bgcolor="#ff0000">
<img src="images/buttons/commercial_users.png">
</td>
<td colspan="1" bgcolor="#ffbf00">
<img src="images/buttons/student_special.png">
</td>
<td colspan="1" bgcolor="#40b000">
<img src="images/buttons/student_special.png">
</td>
<td colspan="1" bgcolor="#ff00cc">
<img src="images/buttons/instruction.png">
</td>
<td colspan="1" bgcolor="#cc00cc">
<img src="images/buttons/learning_maple.png">
</td>
<td colspan="1" bgcolor="#4040ff">
<img src="images/buttons/download.png">
</td>
</tr>
</table>
You can see in this line <table align="center" cellpadding="0" cellspacing="15"> the spacing is 15, but when checking on any browser it shows as it set to 0
Any ideas how to solve it?
Thanks in advance,
Shahar
Ok, I guess I was too hasty.
It appears that the table used two definitions from boilerplate.css
table {
/* [disabled]border-collapse: collapse; */
/* [disabled]border-spacing: 0; */
}
As you can see, simply disabling them resolved the issue.
If there is any other option to override without disabling (maybe usage of !important) I'll be glad to know about it.

Resources