Re: OnChangeAjaxBehavior in ListView
Just browsed through my new copy of Wicket in Action. There are warnings to use Wicket/Ajax with tables and ListView - I have both. However the discussed problems seems to be mainly related to refreshing. My problem is that several component models get updated when only one 'TextField' was edited; therefore the refreshed components gets an incorrect value. When/if I submit the form the usual (non ajax) way everything is corrected. /Anders Anders Peterson wrote: Here the code, html and Java fragments, for the tr. /Anders Timo Rantalaiho wrote: On Mon, 29 Sep 2008, Anders Peterson wrote: I'm using OnChangeAjaxBehavior with a TextField. The TextField is in a table cell that is repeated using a ListView. When I change the value of one of the TextFields more than one of the underlying models get updated - the one that was supposed to be updated and all following in the list. If I modify the first TextField then all underlying models get the same value. If I modify the second then all except the first... Hello, It sounds like all your TextFields models would be connected to each other. Show us the code and we'll see. Best wishes, Timo - 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]
Re: OnChangeAjaxBehavior in ListView
Anders, If you strip out all the fancy financials and create the simplest example that demonstrates the issue (eg use Arrays.asList to make a short list of numeric literals and use TextField instead of ContextTextField), you'll either solve the problem in the process or you can create a small quickstart. Unless I have misunderstood your code, in essence, the problem you are solving is similar (in terms of its solution) to keeping a shopping-cart's total field updated via Ajax whenever an orderline's quantity changes. Regards - Cemal http://www.jWeekend.co.uk http://jWeekend.co.uk Anders Peterson-2 wrote: Just browsed through my new copy of Wicket in Action. There are warnings to use Wicket/Ajax with tables and ListView - I have both. However the discussed problems seems to be mainly related to refreshing. My problem is that several component models get updated when only one 'TextField' was edited; therefore the refreshed components gets an incorrect value. When/if I submit the form the usual (non ajax) way everything is corrected. /Anders Anders Peterson wrote: Here the code, html and Java fragments, for the tr. /Anders Timo Rantalaiho wrote: On Mon, 29 Sep 2008, Anders Peterson wrote: I'm using OnChangeAjaxBehavior with a TextField. The TextField is in a table cell that is repeated using a ListView. When I change the value of one of the TextFields more than one of the underlying models get updated - the one that was supposed to be updated and all following in the list. If I modify the first TextField then all underlying models get the same value. If I modify the second then all except the first... Hello, It sounds like all your TextFields models would be connected to each other. Show us the code and we'll see. Best wishes, Timo - 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] -- View this message in context: http://www.nabble.com/OnChangeAjaxBehavior-in-ListView-tp19725001p19816463.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OnChangeAjaxBehavior in ListView
Here the code, html and Java fragments, for the tr. /Anders Timo Rantalaiho wrote: On Mon, 29 Sep 2008, Anders Peterson wrote: I'm using OnChangeAjaxBehavior with a TextField. The TextField is in a table cell that is repeated using a ListView. When I change the value of one of the TextFields more than one of the underlying models get updated - the one that was supposed to be updated and all following in the list. If I modify the first TextField then all underlying models get the same value. If I modify the second then all except the first... Hello, It sounds like all your TextFields models would be connected to each other. Show us the code and we'll see. Best wishes, Timo ListViewBLView tmpViews = new ListViewBLView(ID.VIEWS, this.getPortfolio().getViews()) { @Override public void populateItem(ListItemBLView aViewsListItem) { final BLView tmpView = aViewsListItem.getModelObject(); final ContextLabelNumber tmpTotalWeightLabel = new ContextLabelNumber(ID.TOTAL_WEIGHTS, new PropertyModelNumber(tmpView, ID.TOTAL_WEIGHTS), StandardType.PERCENT); tmpTotalWeightLabel.setOutputMarkupId(true); aViewsListItem.add(new TextFieldString(ID.NAME, new PropertyModelString(tmpView, ID.NAME))); aViewsListItem.add(new DeleteView(ID.DELETE, new ModelBLView(tmpView))); LoadableDetachableModelNumber tmpMarketReturnModel = new LoadableDetachableModelNumber() { @Override protected BigDecimal load() { return myPage.getBlackLittermanModel().calculatePortfolioReturn(tmpView.getWeightList()); } }; aViewsListItem.add(new ContextLabelNumber(ID.PORTFOLIO_RETURN, tmpMarketReturnModel, StandardType.PERCENT)); aViewsListItem.add(new ContextTextFieldNumber(ID.RETURN, new PropertyModelNumber(tmpView, ID.RETURN), StandardType.PERCENT)); ListViewViewWeight tmpViewWeightTextFields = new ListViewViewWeight(ID.WEIGHTS, tmpView.getViewWeights()) { @Override protected void populateItem(ListItemViewWeight aViewWeightsListItem) { final ViewWeight tmpViewWeight = aViewWeightsListItem.getModelObject(); ContextTextFieldNumber tmpWeightTextField = new ContextTextFieldNumber(ID.WEIGHT, new PropertyModelNumber(tmpViewWeight, ID.WEIGHT), StandardType.PERCENT); aViewWeightsListItem.add(tmpWeightTextField); tmpWeightTextField.add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget aWeightTextFieldChangeTarget) { System.out.println(AJAX!); System.out.println(THIS ViewWeight: + tmpViewWeight); for (ViewWeight tmpVW : tmpViewWeight.getView().getViewWeights()) { System.out.println(LOOP ALL ViewWeights: + tmpVW); } System.out.println(); aWeightTextFieldChangeTarget.addComponent(tmpTotalWeightLabel); } }); } }; aViewsListItem.add(tmpViewWeightTextFields); aViewsListItem.add(tmpTotalWeightLabel); }; }; tr wicket:id=views td scope=colinput name=name type=text id=name size=16 wicket:id=name //td td scope=cola wicket:id=delete href=/se/optimatika/blapp/gui/PgInputViews.htmlimg src=images/minus.gif alt=Delete View width=14 height=14 hspace=1 vspace=3 border=0 //a/td td scope=coldiv align=rightspan wicket:id=portfolioReturn1.2%/span/div/td td scope=coldiv align=center div align=right input name=return type=text id=return size=8 wicket:id=return / /div /div/td th scope=col@/th td wicket:id=weights scope=coldiv align=right input name=weight type=text id=weight size=7 maxlength=8 wicket:id=weight / /div/td th scope=col=/th td scope=coldiv align=rightspan wicket:id=totalWeights100.00%/span/div/td /tr- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OnChangeAjaxBehavior in ListView
Hi, I'm using OnChangeAjaxBehavior with a TextField. The TextField is in a table cell that is repeated using a ListView. When I change the value of one of the TextFields more than one of the underlying models get updated - the one that was supposed to be updated and all following in the list. If I modify the first TextField then all underlying models get the same value. If I modify the second then all except the first... Anyone else seen this? Wicket 1.4M3 /Anders - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OnChangeAjaxBehavior in ListView
On Mon, 29 Sep 2008, Anders Peterson wrote: I'm using OnChangeAjaxBehavior with a TextField. The TextField is in a table cell that is repeated using a ListView. When I change the value of one of the TextFields more than one of the underlying models get updated - the one that was supposed to be updated and all following in the list. If I modify the first TextField then all underlying models get the same value. If I modify the second then all except the first... Hello, It sounds like all your TextFields models would be connected to each other. Show us the code and we'll see. Best wishes, Timo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]