This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jun 15, 2011, 4:02 PM
13 Posts
topic has been resolvedResolved

(solution found) repeat control, bound to bean and row count

  • Category: Other
  • Platform: Not Applicable
  • Release: 8.5.1
  • Role: Developer
  • Tags: Repeat Control
  • Replies: 2
See Russels post and my reply, I switched form EL to SSJS.
.............
The problem I am having is the "rows" property of a repeat control, it appears if you don't specify, it defaults to 30.
 
I have bound to a backing bean, back end logic works correctly.  I have a repeat within a repeat, where the "inner" repeat is a table wher i am dynamically building the rows, which changes for each "outer" repeat.  Many of my tables are over 30 rows.  The help on "rows" property indicates if you set "repeatControls" to true, and leave out the "rows"  property, it will iterate over all of them, for me, it did no iterations.
 
Each row object ("vAuditDocs" below)has a property .FieldCount, which is integer, I thought I could make use of that, but I keep gettign Double to Integer conversion errors...I'm pretty sure rows would be Integer, the value of FieldCount is 10 or 98 etc.
 
I have a  repeat control lloking like this...
 
<xp:repeat
                            id="repeat3"
                            value="#{vAuditDocs.EventDatas}"
                            var="vAuditDocsItems"
                            indexVar="vAuditDocsItemIndex"
                            rows="#{vAuditDocs.FieldCount}"">
                            <xp:tr>
                                <xp:td>
                                    <xp:text
 
 ...where the row EL...vAuditDocs.FieldCount = an integer, but getting conversion errors.  As a temporary work around, I have just set: rows="500", which seems incredibly clunky, but I think  that sets the MAX rows to 500 and it will iterate up to that.
 
Anyone any ideas why my bean property won't work to set rows (it's actually a JSON obect returned by backing bean, so value="#{vAuditDocs.EventDatas}" is actually an array in a JSON object).

p.s.  I just chnaged the property FieldCount to String in my backing bean (thought that rows="20" is actually a String, not integer), getting
java.lang.ClassCastException: java.lang.String incompatible with java.lang.Integer
    com.ibm.faces.component.UIDataIterator._getRows(UIDataIterator.java:133)


Any comments welcome

Thanks in advance.
 
Nick
 
Jun 15, 2011, 5:21 PM
23 Posts
Re: repeat control, bound to bean and row count
 
I have a production solution that does exactly what you are doing and I found the only way to get the repeats to work with the bean was to actually call a method that returned the collection to process.

So I have a method on the bean called getTableRows which returns a Vector.
 
In the repeat control for the Iteration I use a single line of SSJS like this: theBean.getTableRows()
 
Took me a while to figure it out and I was never able to simply map it using EL.  Maybe someone else has though.
 
Hope this helps.
Jun 15, 2011, 7:12 PM
13 Posts
Re: repeat control, bound to bean and row count
Russel,
 
THanks for your reply.

Well wadda-ya-know...
 
I switched from EL...

<xp:repeat
                            id="repeat3"
                            value="#{vAuditDocs.EventDatas}"
                            var="vAuditDocsItems"
                            indexVar="vAuditDocsItemIndex"
                            rows="#{vAuditDocs.FIELDS_FOUND_COUNT}">
 
...to SSJS on the rows...
<xp:repeat
                            id="repeat3"
                            value="#{vAuditDocs.EventDatas}"
                            var="vAuditDocsItems"
                            indexVar="vAuditDocsItemIndex"
                            rows="#{javascript:vAuditDocs.FIELDS_FOUND_COUNT}">
 
...and it works!!!
 
As a side note, I wonder if it really even matters on the "rows", I guess it should be sort of hard coded, I suppose if my backing bean went AWOL and 1 table had 10,000 elements, my code above will just say, OK, keep going until end of table...which would be bad, a constant threshold  of 500, or whatever, would at least safe guard against this.
 
I can't think why EL shouldn't work, but whatever, many, many thanks for your help.
 
 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal