Different input type based on data type of column in listview in wicket

163 views Asked by At

I am having a list of InputColumnsVO which will have column name and column datatype attributes..I am thinking to iterate this list of input columns object using Listview and display input boxes based on the column data type.For example:

if datatype is date,
        display DateTextField,
if datatype is numeric,
        display dropdown,
if datatype is string, 
       display a textfield.

Is this achievable in wicket?or is there an alternative way to the design?

2

There are 2 answers

3
martin-g On BEST ANSWER

Depending on the type add a Panel that contains the respective form component. If the HTML markup is really simple and you don't want to have a special Panel for it then use a Fragment instead.

2
zeratul021 On

We do it in a similar way: we have a listview/dataview of configuration options that populates the item with a widget retrieved from a factory for creating editors based on datatype of that option. Factory returns FormComponent/FormComponentPanel/Panel that we add to the item.