Here the (simplified) code that creates the ListViev, TextFields and Label. 
/Anders

        final MyPageForm tmpForm = new MyPageForm(ID.FORM);
        this.add(tmpForm);

        final ContextLabel<Number> tmpTotalWeightsLabel = new 
ContextLabel<Number>(ID.TOTAL_WEIGHTS, new 
PropertyModel<Number>(this.getPortfolio(), ID.TOTAL_WEIGHTS), 
StandardType.PERCENT);
        tmpTotalWeightsLabel.setOutputMarkupId(true);

        final ListView<BLMarketInstrument> tmpMarketInstrumentListView = new 
ListView<BLMarketInstrument>(ID.INSTRUMENTS, 
this.getPortfolio().getMarketInstruments()) {

            @Override
            public void populateItem(final ListItem<BLMarketInstrument> 
aListItem) {
                final BLMarketInstrument tmpMarketInstrument = 
aListItem.getModelObject();
                final ContextTextField<Number> tmpMarketWeightTextField = new 
ContextTextField<Number>(ID.MARKET_WEIGHT, tmpMarketInstrument, 
StandardType.PERCENT);
                aListItem.add(tmpMarketWeightTextField);
                tmpMarketWeightTextField.add(new OnChangeAjaxBehavior() {
                    @Override
                    protected void onUpdate(final AjaxRequestTarget someTarget) 
{
                        someTarget.add(tmpTotalWeightsLabel);
                    }
                });
            }
        };
        tmpMarketInstrumentListView.setReuseItems(true);


        tmpForm.add(tmpMarketInstrumentListView);
        tmpForm.add(tmpTotalWeightsLabel);



On 13 okt 2011, at 12:40, Anders Peterson wrote:

> Hi,
> 
> Upgrading to wicket 1.5.1 from 1.4.18 my ajax updates stopped working.
> 
> I have a page with a form. Inside the form there is a repetition (ListView) 
> that among other things creates a text field for each item (ListItem). Each 
> of those text fields has an OnChangeAjaxBehavior set that should update a 
> label. The label should continously display the total sum of the numbers in 
> the text fields.
> 
> With wicket 1.4.18 (and previous versions) this worked fine.
> 
> With 1.5.1 only the first text field in the repetition gets the correct ajax 
> behavior - it works the way I want it, and the way it worked with 1.4.*. The 
> other text fields are "dead", except for focus set/removed. While typing in 
> any of the other text fields nothing is updated (the ajax debug window shows 
> no activity). When focus is removed I get a NullPointerException regardless 
> of what I've changed.
> 
> Is this a (known) bug, or is there a difference between 1.4 and 1.5 that I've 
> missed?
> 
> /Anders
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to