>From: lisaan markuen <[EMAIL PROTECTED]> > > Hi., > I'm trying CLAY and fed up with displaying dynamic > datatable (list) coming from my managed bean (already > went through the examples but no success yet). > Could anyone please give me an example snippet of how > to insert jsfid into the mock html code so that I > could achieve same like: > > JSF code: ><h:dataTable value="#{managedBean.list}" var="item"> ><h:outputText value="#{item.property}" ></h:dataTable> > > >
I'll give you a couple options. My first recommendation would be to use the tomahawk dataList component. Clay configuration definition for the tomahawk dataList: <component jsfid="t:dataList" componentType="org.apache.myfaces.HtmlDataList" extends="baseHtml"> <attributes> <set name="id" bindingType="VB" /> <set name="binding" bindingType="VB" /> <set name="forceId" bindingType="VB" /> <set name="forceIdIndex" bindingType="VB" /> <set name="value" bindingType="VB" /> <set name="var" bindingType="VB" /> <set name="rows" bindingType="VB" /> <set name="first" bindingType="VB" /> <set name="enabledOnUserRole" bindingType="VB" /> <set name="visibleOnUserRole" bindingType="VB" /> <set name="layout" bindingType="VB" /> <set name="rowIndexVar" bindingType="VB" /> <set name="rowCountVar" bindingType="VB" /> </attributes> </component> HTML using tomahawk dataList: <span jsfid="t:dataList" id="data1" styleClass="standardList" var="person" value="[EMAIL PROTECTED]" layout="simple" rowCountVar="rowCount" rowIndexVar="rowIndex" allowBody="true"> <span jsfid="outputText" value="#{person.firstName}"/> <span jsfid="outputText" value="#{person.lastName}"/> <span jsfid="t:htmlTag" value="br" rendered="#{(rowIndex != (rowCount - 1))}"/> </span> Another option is to use the clayForEach component. Clay configuration definition: <component jsfid="myItem" extends="outputText"> <attributes> <set name="value" value="[EMAIL PROTECTED]"/> </attributes> </component> The var attribute in the example below is like the JSTL var attribute. It's the name of a map that will be placed in session scope. It will be populated from the value EL, a value binding expression that returns a Map, List or Object[]. The bodyJsfid attribute is the content that will be repeated for each item in the value list. <span jsfid="clayForEach" var="mySessionScopedMap" value="[EMAIL PROTECTED]" bodyJsfid="myItem"/> This is probably more helpful when the bodyJsfid is a html template. <table> <tr jsfid="clayForEach" var="mySessionScopedMap" value="[EMAIL PROTECTED]" bodyJsfid="/myItem.html"/> </table> html template file myItem.html: <tr><td>[EMAIL PROTECTED]</td></tr> Gary > > Thank you. > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >