I'm using JSF 2.2 with Prime Faces 5.3.
I'm trying to create an html5 component with dynamic options. The goal is to create something similar to the f:selectItems tag
At the moment I've the following code(datalist.xhtml file) for the datalist tag
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns:cc="http://xmlns.jcp.org/jsf/composite">
<cc:interface></cc:interface>
<cc:implementation>
<datalist id="#{cc.attrs.id}">
<cc:insertChildren/>
</datalist>
</cc:implementation>
</html>
and the following for the single option(option.xhtml file)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns:cc="http://xmlns.jcp.org/jsf/composite">
<cc:interface>
<cc:attribute name="value" type="java.lang.String" default=""/>
<cc:attribute name="label" type="java.lang.String" default=""/>
</cc:interface>
<cc:implementation>
<option value="#{cc.attrs.value}" label="#{cc.attrs.label}"/>
</cc:implementation>
</html>
With this approach I can create something like this
<myTag:dataList id="test">
<myTag:option value="1" label="label1"/>
<myTag:option value="2" label="label2"/>
<myTag:option value="3" label="label3"/>
</myTag:dataList>
But I need something that allows me have a dynamic list of options. I expect to write the following code(or similar)
<myTag:dataList id="test">
<myTag:options value="#{myBean.myCollection}" var="mySingleObj" itemValue="mySingleObj.value" itemLabel="mySingleObj.label"/>
</myTag:dataList>