0

I have a datatable from which I open with a click on an image the <rich:modalPanel>. But the <rich:componentControl for="panel" attachTo="showPreview" must have the exact id, in my case below: showPreview, but as my link is inside a dataTable, it will be generated like 1:showPreview 2:showPreview.....n:showPreview

Is there any way to know in which line of the table i am, to get a dynamic binding?

My XHTML in JSF 1.2 looks something like this:

<h:dataTable  styleClass="tb_tabletag" id="dtContentPosts" value="#{listOfObjects}" var="object">
    <h:column id="columnnumber" >
        <h:outputLink id="showPreview" value="#">
        <h:graphicImage value="preview.png" />      
        <rich:componentControl for="panel" attachTo="showPreview" operation="show"
            event="onclick"/>
        </h:outputLink>
    </h:column>
</h:dataTable>
...
...
...
<rich:modalPanel id="panel" autosized="true">
  some stuff 
</rich:modalPanel>

Thank you for any help!

Joergi
  • 1,527
  • 3
  • 39
  • 82
  • 1
    Check the RichFaces 3.3 live demo for `` and `` example: [Edit Table with ModalPanel](http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=editDataTable) – Luiggi Mendoza Sep 06 '12 at 16:35

1 Answers1

1

Thanks Luiggi for your link, with the given source code,this helped me to find my simple trick: i get now the number with: #{listOfObjects.indexOf(object)}

the only important thing is, that the modalPanel is in a <h:column></h:column> to receive the correct number works perfect

Joergi
  • 1,527
  • 3
  • 39
  • 82