You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Branislav Kalas <bk...@gmail.com> on 2010/07/11 23:33:54 UTC

Reset values after submit with validation error in table components

Hi,
I have table which is part of form.
Table extends 
org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable.
In that table i use some AbstractColumns that renders input boxes, for 
example:

columns.add(new AbstractColumn<TakeBackPalletRollInfo>(new 
StringResourceModel("header.takenBackNetto", this, null)) {
             public void 
populateItem(Item<ICellPopulator<TakeBackPalletRollInfo>> cellItem, 
String componentId,
                     IModel<TakeBackPalletRollInfo> rowModel) {
                 RequiredBigDecimalWithoutLabel takenBackBrutto = new 
RequiredBigDecimalWithoutLabel(componentId,
                         new PropertyModel(rowModel, "newChars.netto"));
                 cellItem.add(takenBackBrutto);
             }
});

Data provider code:
public class TakeBackPalletProvider extends 
SortableDataProvider<TakeBackPalletRollInfo> {
     private TakeBackPallet takeBackPallet;

     public TakeBackPalletProvider(TakeBackPallet takeBackPallet) {
         this.takeBackPallet = takeBackPallet;
     }

     public Iterator iterator(int first, int count) {
         return takeBackPallet.getRollInfoList().iterator();
     }

     public int size() {
         return takeBackPallet.getRollInfoList().size();
     }

     public IModel<TakeBackPalletRollInfo> model(TakeBackPalletRollInfo 
object) {
         return new Model(object);
     }
}

After form submit, when validation error occurs  (like not filled 
required field) on some field which is not in table, values in table 
resets to it's initial values.
Where can be problem?
Thanks.






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


Re: Reset values after submit with validation error in table components

Posted by Igor Vaynberg <ig...@gmail.com>.
see datatable#setitemreusestrategy

-igor

On Sun, Jul 11, 2010 at 2:33 PM, Branislav Kalas <bk...@gmail.com> wrote:
> Hi,
> I have table which is part of form.
> Table extends
> org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable.
> In that table i use some AbstractColumns that renders input boxes, for
> example:
>
> columns.add(new AbstractColumn<TakeBackPalletRollInfo>(new
> StringResourceModel("header.takenBackNetto", this, null)) {
>            public void
> populateItem(Item<ICellPopulator<TakeBackPalletRollInfo>> cellItem, String
> componentId,
>                    IModel<TakeBackPalletRollInfo> rowModel) {
>                RequiredBigDecimalWithoutLabel takenBackBrutto = new
> RequiredBigDecimalWithoutLabel(componentId,
>                        new PropertyModel(rowModel, "newChars.netto"));
>                cellItem.add(takenBackBrutto);
>            }
> });
>
> Data provider code:
> public class TakeBackPalletProvider extends
> SortableDataProvider<TakeBackPalletRollInfo> {
>    private TakeBackPallet takeBackPallet;
>
>    public TakeBackPalletProvider(TakeBackPallet takeBackPallet) {
>        this.takeBackPallet = takeBackPallet;
>    }
>
>    public Iterator iterator(int first, int count) {
>        return takeBackPallet.getRollInfoList().iterator();
>    }
>
>    public int size() {
>        return takeBackPallet.getRollInfoList().size();
>    }
>
>    public IModel<TakeBackPalletRollInfo> model(TakeBackPalletRollInfo
> object) {
>        return new Model(object);
>    }
> }
>
> After form submit, when validation error occurs  (like not filled required
> field) on some field which is not in table, values in table resets to it's
> initial values.
> Where can be problem?
> Thanks.
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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