I want to display some data through primefaces datalist component. To achieve this I have an arrayList like ArrayList<Person>
.
The person class looks something like this
class Person{
private String name;
private String age;
private ArrayList<String> hobbies;
}
To display the data I'm using the following code:
<p:dataList value="{gameBean.persons}" var="person" itemType="disc">
Name: #{person.getName()}, Age: #{person.getAge()},
<h:link value="Hobbies" onclick="dlg1.show();" />
</p:dataList>
What I want do do now, is to create a link that opens a dialog when clicked:
<p:dialog header="Hobbies" widgetVar="dlg1" modal="true"height="100">
//iterate through hobbies list to print it
</p:dialog>
So far this is working because I've hard coded the dialog as mentioned above in the xhtml file.
This method is of course not working for a dynamic amount of persons as I can not hard code the dialogs and the links. My question is, how can I create this dialogs programmatically and assign the right widgetVar variable to the onClick method of the Links?
Any help is highly apprechiated, cheers Nikolaus