I would like to create a table with 4 columns and 4 or more rows (so 16 or more items per page) using a single repeat control. Is this possible at all? I have achieved the desired affect in the past using div tags and display in-line, but would like to know whether it's possible to achieve this using a table. When the code is generated by a repeat control, how could I tell it to create a new row when it reaches the 4th element?? Any ideas at all?
The repeat control has facets for the header and footer that you can use to output the html tags required for the table header and footer like this...
<xp:this.facets>
<xp:text disableTheme="true" xp:key="header" escape="false">
<xp:this.value><![CDATA[
<table>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<th>Column 4</th>
</tr>
</thead>
<tbody>]]></xp:this.value>
</xp:text>
<xp:text disableTheme="true" xp:key="footer" escape="false">
<xp:this.value><![CDATA[
</tbody>
</table>]]></xp:this.value>
</xp:text>
</xp:this.facets>
Then inside your repeat control you could repeat a single computed field which will output the html and cell contents for the table. use the Repeat Index variable to determine if the computed field control should include the <tr> or </tr> tags and make sure the control has been set to display contents as html.
Related
I have two columns of two different tables that I want to compare (same worksheet)
I have column "A" [which belongs to a master table] where I have Owners names for different projects.
Then I have column "D" [which belongs to a table that shows the number of project each owner has]
What I want to do is that every time I write new projects with their respective Owners in the first table, if the owner is not on the second table, Column "D", that the new name is added automatically to to this column "D".
Is that possible?
Edit:
Hi thank you for your replies
Here is a graphic example.
Table1&2
Table 1 (All tasks with their owner, manually entered)
<table><tr>
<th>Owner</th>
<th>Task</th>
</tr>
<tr>
<td>Mary</td>
<td>Task1</td>
</tr>
<tr>
<td>Mary</td>
<td>Task2</td>
</tr>
<tr>
<td>Patrick</td>
<td>Task3</td>
</tr>
<tr>
<td>John</td>
<td>Task</td></tr></table>
Table 2 (all the Owners)
<table><tr>
<th>Owner</th>
<th>Overdue Tasks</th>
</tr>
<tr>
<td>Mary</td>
<td>2</td>
</tr>
<tr>
<td>John</td>
<td>1</td>
</tr>
<tr>
<td>Patrick</td>
<td>1</td>
</tr>
<tr>
</table>
So what I want is if I add new tasks in table 1 and they have an owner that is not yet in table 2, that the name of this new Owner is automatically updated in the table 2.
What If tried so far was to add a new column with =NOT(ISNUMBER(MATCH(H2,$P$2:$P$46,0)))
to check if the name is in table 2
and then tried with =IF($L2="TRUE",SUM($H2)," ") in the second table.
But I think thats a paradox and won't work
Also tried =IFERROR(VLOOKUP($H2,$P2:$P145,COLUMN(H2),FALSE),"")
But doesn't work either
I have a suitelet in which in run html code having an html table. I have given checkbox to the table. I wanted to retrieve number of lines and values in table which are checked after I click Submit on Suitelet. However, I only get one value of checkbox and not how many lines I have set the checkbox true.
<table>
<tbody>
<tr>
<td>
<input type="checkbox" class="select-items" name="selectitem" id="selectitem">
</td>
</tr>
<tbody>
<table>
<table id="example1" class="cell-border" cellspacing="0" width="100%">
<thead>
<tr>
<th>Entry Page Name</th>
<th>Visits</th>
<th>Bounce</th>
</tr>
</thead>
<tbody>
<s:iterator value="table" var="dashboardTable">
<tr>
<td><s:property value="actionName" /></td>
<td><s:property value="count" /></td>
<td><s:property value="sum" /></td>
</tr>
</s:iterator>
</tbody>
</table>
This is my code.
(Struts) I want to paginate my data in table for each 10 rows. Please can anyone help?
You seem to be populating data in a table , pagination in any grid has these following steps
I'm going to explain a simple but not so elegant method .
let's say you have 100 records , and you wish to display 10 records / page
In the grid (Table and other elements) you put a dropdown , which has 1-10 page numbers (since you have 100 records / 10 records per page) , which you can get by doing a select count(*).
1.Initially you display limited data , by executing a sql select with limit clause , say you display 10 records initially .
EX : select * from patient limit 1,10 - get first 10 records
2.Next user wishes to get patients from 5th page , hence he selects '5' from drop down and clicks "fetch" , backend you need to multiply 5 * 10 (records you wish to display per page" now you execute following sql query
EX : select * from patient limit 51,60
now the records from 51 - 60 are fetched and displayed
this a simple and easy pagination which doesn't involve jquery or any javascript , you can modify it by removing page no dropdown and putting it for display in a linear fashion by using many libraries .
Hope it helps.
JSF:
...
xmlns:t="http://myfaces.apache.org/tomahawk">
<t:panelGrid columns="4">
...
</t:panelGrid>
It dynamically generates plain old HTML table with tr's and td's elements.
How can I set specific css styles for these tr and/or td elements?
Use columnClasses and rowClasses attributes to give each cell a unique class
For example:
<t:panelGrid columns="4" columnClasses="a,b,c,d" rowClasses="x,y,z">
</t:panelGrid>
columnClasses
The columnClasses attribute accepts a comma-delimited list of CSS style classes that will be applied to the columns of the table. Style classes for an individual column may also be defined in a space separated list. A style class is applied to a table column as the value for the class attribute of rendered td or th element.
The algorithm used to apply the CSS style classes to the table columns is simple. In the table rendering process, style classes are applied to columns one at a time until (a) there are no more columns to display or (b) there are no more style classes to apply.
* If (a) happens at the same time as (b), the next row in the table is rendered.
* If (a) happens before (b), the remaining style classes are ignored.
* If (b) happens before (a), the remaining columns will not have style classes.
rowClasses
The rowClasses attribute accepts a comma-delimited list of CSS style classes to be applied to the rows of the table. Style classes for an individual row may also be defined in a space separated list. A style class is applied to a table row as the value for the class attribute of rendered tr element.
Style classes are applied to rows in the same order that they are defined. For example, if there are two style classes, the first is applied to the first row, the second is applied to the second row, the first is applied to the third row, the second is applied to the fourth row, and so on. The list of styles is looped over from the beginning until there are no more rows to display.
In my standard JSF Project (Mojarra 2.0.3)
This tag generates:
<h:panelGrid border="1"
columns="4"
columnClasses="a,b,c,d"
rowClasses="x,y,z">
<h:outputText value="ax"/>
<h:outputText value="bx"/>
<h:outputText value="cx"/>
<h:outputText value="dx"/>
<h:outputText value="ay"/>
<h:outputText value="by"/>
<h:outputText value="cy"/>
<h:outputText value="dy"/>
<h:outputText value="az"/>
<h:outputText value="bz"/>
<h:outputText value="cz"/>
<h:outputText value="dz"/>
</h:panelGrid>
This HTML:
<table border="1">
<tbody>
<tr class="x">
<td class="a">ax</td>
<td class="b">bx</td>
<td class="c">cx</td>
<td class="d">dx</td>
</tr>
<tr class="y">
<td class="a">ay</td>
<td class="b">by</td>
<td class="c">cy</td>
<td class="d">dy</td>
</tr>
<tr class="z">
<td class="a">az</td>
<td class="b">bz</td>
<td class="c">cz</td>
<td class="d">dz</td>
</tr>
</tbody>
</table>
I have a simple JSF datatable, which currently has four columns, one header row and (with current data) three data rows.
I have to add three extra columns; that part's easy.
I also want to add another header row before the existing header row with headers that span a subset of the columns.
The desired result is something like:
Column 1: first row empty; header on second row.
Columns 2-4: first row header spans 3 columns; second row has individual column headers.
Columns 5-7: first row header spans 3 columns; second row has individual column headers.
Is this possible? If so, how do I do it?
Following are images showing what it should look like.
This is the data table before I've changed anything.
Table Example 1 http://www.isw.com.au/home/sjleis/stuff.nsf/tableexample1.gif
This is the data table after I've added three columns. I was able to do this easily.
Table Example 1 http://www.isw.com.au/home/sjleis/stuff.nsf/tableexample2.gif
This shows the desired end result, which I can't figure out. Note the "Retail Sales" and "Fleet/Gov Sales" headers each span three columns.
Table Example 1 http://www.isw.com.au/home/sjleis/stuff.nsf/tableexample3.gif
This would be easy if you were using Richfaces (as Bozho mentions) with the breakBefore attribute.
Here's a quick example:
<rich:dataTable value="#{countryCodeListFactory}" var="c">
<f:facet name="header">
<rich:columnGroup>
<rich:column colspan="2">Main</rich:column>
<rich:column colspan="4">Other Details</rich:column>
<rich:column breakBefore="true">Country ID</rich:column>
<rich:column>Name</rich:column>
<rich:column>Region</rich:column>
<rich:column>Alpha</rich:column>
<rich:column>ISO</rich:column>
<rich:column>Flag Path</rich:column>
</rich:columnGroup>
</f:facet>
<rich:column>#{c.countryId}</rich:column>
<rich:column>#{c.countryName}</rich:column>
<rich:column>#{c.region}</rich:column>
<rich:column>#{c.alpha3}</rich:column>
<rich:column>#{c.isoNum}</rich:column>
<rich:column>#{c.flagImage}</rich:column>
</rich:dataTable>
If you're not then hopefully you're using facelets. Then you can build the table manually using the <ui:repeat>
<table>
<tr>
<th colspan="2">Main</th>
<th colspan="4">Details</th>
</tr>
<tr>
<th>ID</th>
<th>Name</th>
<th>Region</th>
<th>Alpha</th>
<th>ISO</th>
<th>Flag</th>
</tr>
<ui:repeat value="#{countryCodeListFactory}" var="c">
<tr>
<td>#{c.countryId}</td>
<td>#{c.countryName}</td>
<td>#{c.region}</td>
<td>#{c.alpha3}</td>
<td>#{c.isoNum}</td>
<td>#{c.flagImage}</td>
</tr>
</ui:repeat>
</table>
You can't do this with <h:dataTable>. Well, you can with some ugly hacks, like modifying the DOM with javascript and adding the desired columns, but that's not what you should do.
Take a look at RichFaces dataTable - its columns support the colspan attribute.