I couldn't find a solution for this in other posts, so here is my problem. (In advance, I use JSF 2 with Mojarra implementation and Primefaces 3.2 on a JBoss 7.1 AS)
I am building a search-mask that should be generated dynamically during runtime. I know from another post that I should use a dataTable for that. That is what I will do.
But the search-mask consists of 3 parts, the search-criterion (e.g. name, birthday,...), the operator (is, is not, larger than, in range,...) and the operand (what the user will give as search-input).
My goal is to get the search-mask get generated dynamically, BUT the type of input field is dependent on what criterion+operator has been choosen by the user.
So if the user chose criterion: "name" and operator: "is not" from the dropdown boxes, then the input field for the operand should be just a simple p:inputText.
But if the user chose criterion "birthday" and operator: "before", then the input field should be a datepicker like p:calendar.
My idea was to use a p:dataTable for a List of "SearchRow" objects where every object has an array of criteria and operands to use them in a h:selectOneMenu.
Then I add a valueChangeListener to the selectMenues and in there I calculate and create the right type of UIComponent I need as inputfield.
But I have no idea how to add that UICOmponent as the 3rd column inside the dataTable.
So is my idea any good and is there a way at all to solve my problem?
Thanks in advance!