a better way is to have a factory method for the internal components,
that way the user can do
component newcomponent(string id, imodel model) {
component c=super.newcomponent(id, model);
c.add(whateverbehavior);
return c;
}
-igor
On Mon, Nov 3, 2008 at 6:02 AM, Gianni Doe [EMAIL PROTECTED] wrote:
I've developed a custom form component (FormComponentPanel), a date picker,
that makes use of 2 fields - a display TextField and a HiddenField for the
model data. I'm then adding this to the page with a span tag:
span wicket:id=dropoffDate[dropoff date picker]/span
Then in the java :
DatePicker dropoffDatePicker = new DatePicker(dropoffDate, new
PropertyModelLocalDate(this, dropoffDate),
(new LocalDate()).minusDays(0), (new
LocalDate()).plusYears(3));
I'm after some advice on the best way to attach an AJAX behaviour to the
component. If for example I add an AJAX behaviour directly to the date
picker component then it's attached to the span tag and obviously doesn't
work. The only way I've found to get around this is to expose the date
display field with a public getter so I can then attach the onchange event.
dropoffDatePicker.getDateDisplayField().add(new
AjaxFormComponentUpdatingBehavior(onchange) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
..
}
});
Any suggestions for a better way to do this that doesn't involve exposing
the innards?
-Gianni
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]