T5: select within table grid
Hi,
I am trying to show a table with a column with comboboxes, but the GridDataSource does not seem to accept a the value type for the generic select model necessary for the combobox.
The most promising stuff i tried is a table containing a column with Longs and one with the selected entry of the available entries for the combo box. The available entries for the combo box are the same for each row.
If I try to specify the combobox parameter directly (as PositionSelection), the "BeanModel does not contain that property". The using an indirect value (slotPosition-Cell) takes care of that, the encoder is meant to do the mapping, but then:
__
Processing of request failed with uncaught exception: Failure writing parameter value of component cms/pages/draft/configuration/Edit:selectedposition: org.apache.tapestry.ioc.internal.util.TapestryException
...
Caused by: org.apache.tapestry.ioc.internal.util.TapestryException [at classpath:com/freiheit/shopping24/extranet/cms/presentation/pages/pages/draft/configuration/EditConfiguration.html, line 55, column 25]
at org.apache.tapestry.internal.bindings.PropBinding.set(PropBinding.java:71)
at org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.writeParameter(InternalComponentResourcesImpl.java:250)
... 88 more
Caused by: java.lang.NullPointerException
at $PropertyConduit_119cce2381b.set($PropertyConduit_119cce2381b.java)
at org.apache.tapestry.internal.bindings.PropBinding.set(PropBinding.java:67)
I have the feeling I am doing something the wrong way, it should not be so hard to nest these basic elements, is it?
Thanks,
Axel Mannhardt
___________________
<form t:type="form" t:id="form" t:clientValidation="false">
<table t:type="grid"
t:id="SlotGrid"
t:source="sourceRows" <!-- of type : GridDataSource (ComponentConfigurationRowModel) -->
t:row="sourceRow"
t:model="rowModel">
<t:parameter name="slotPositionCell"> <!-- of type: Long -->
<select name="selectedPosition" id="selectedPosition"
t:type="select"
t:id="selectedPosition"
t:model="positionSelectModel" <!-- of type GenericSelectModel<PositionSelection> -->
t:value="component.selectedPosition"
t:encoder="positionSelectEncoder"
onchange="JavaScript:document.editSlotsForm.submit()"
/>
</t:parameter>
<!-- ... -->
</table>
</form>
___________________________
private final ValueEncoder<PositionSelection> _encoder = new ValueEncoder<PositionSelection>() {
public String toClient(PositionSelection arg0) {
return new Long(0).toString();
};
public PositionSelection toValue(String arg0) {
return _availableSlots.get(0);
};
};
public ValueEncoder<PositionSelection> getPositionSelectEncoder() {
return _encoder;
}
//container for combo box values
public class PositionSelection implements Labeled, Identifiable<Long> {
final private String _text;
final private Long _position;
public PositionSelection(String text, Long position) {
_text = text;
_position = position;
}
public Long getId() {
return _position;
}
public String getLabel() {
return _text;
}
//container for row values
public class ComponentConfigurationRowModel{
private Long _slotPosition;
private PositionSelection _selectedPosition;
public Long getSlotPosition() {
//getter and setter omitted
}