Re: Repeat every 2 rows in a table

2016-10-14 Thread ganea iulia
Thank you, works great.

On Fri, Oct 14, 2016 at 12:06 PM, Peter Henderson <
peter.hender...@starjar.com> wrote:

> Hi
>
> Change your markup to
>
> ...
> 
> ..
> 
> 
>
>
> 
> 
>
> 
> 
>
>
>
>
>
>
>
>
> On 14 October 2016 at 09:44, ganea iulia  wrote:
>
> > Hello Per, thank you for the links.
> >
> > I have following html code:
> >
> > 
> >   
> >  > width="100%">
> > 
> > 
> > Name
> > Code
> > 
> > 
> > Id
> > 
> > 
> > 
> >
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >  
> >
> > The Java code looks like this:
> >
> > public TestPage(IModel model) {
> > super(model);
> >
> > TestForm tst = new TestForm("testForm", model);
> > tst.setOutputMarkupId(true);
> > add(tst);
> >
> > }
> >
> > class TestForm extends Form {
> > /**
> > *
> > */
> > private static final long serialVersionUID = 1L;
> >
> > public TestForm(String id, IModel model) {
> > super(id, model);
> >
> > List beans = Arrays.asList(new TestBean("Name1", "Code1", 1),
> > new TestBean("Name2", "Code2", 2));
> > add(new ListView("forEachItem", beans) {
> > /**
> > *
> > */
> > private static final long serialVersionUID = 1L;
> >
> > @Override
> > protected void populateItem(ListItem item) {
> >   item.add(new Label("itemName", new PropertyModel(item.getModel(),
> > "name")));
> >   item.add(new Label("itemCode", new PropertyModel(item.getModel(),
> > "code")));
> >   item.add(new Label("itemId", new PropertyModel(item.getModel(),
> "id")));
> > }
> >   });
> > }
> >
> > @Override
> > protected void onSubmit() {
> >
> > logger.info("OnSubmit");
> >
> > }
> > }
> >
> > The code crashes here because itemId belongs to another row.
> > Could you please advise?
> >
> > Thank you
> >
> >
> >
> > On Fri, Oct 14, 2016 at 10:29 AM, Per Newgro  wrote:
> >
> > > Hello ganea,
> > >
> > > you can find many information about your problem at
> > > http://examples7x.wicket.apache.org/index.html
> > > espacially
> > > http://examples7x.wicket.apache.org/repeater
> > >
> > > The user guide can you find here
> > > https://ci.apache.org/projects/wicket/guide/7.x/
> > > Repeaters are explained here
> > > https://ci.apache.org/projects/wicket/guide/7.x/guide/repeaters.html
> > >
> > > You can add a markup container to a list view item and add the required
> > > row components to it.
> > >
> > > Hope that helps
> > > Per
> > >
> > >
> > > Am 14.10.2016 um 09:16 schrieb ganea iulia:
> > >
> > >> Hello,
> > >>
> > >> I have in the html file, a table where I need to repeat every two
> rows.
> > >> So, my table is backed by a bean, where the bean values fill 2 rows of
> > the
> > >> table.
> > >> When new bean instance is created, I need to add new 2 rows to the
> > table.
> > >>
> > >> Thank you
> > >>
> > >>
> > >
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
>
>
>
> --
> Peter Henderson
>
> Director
> Starjar Ltd.
> www.starjar.com
> 0330 088 1662
>


Re: Repeat every 2 rows in a table

2016-10-14 Thread Peter Henderson
Hi

Change your markup to

...

..


   
   


   










On 14 October 2016 at 09:44, ganea iulia  wrote:

> Hello Per, thank you for the links.
>
> I have following html code:
>
> 
>   
>  width="100%">
> 
> 
> Name
> Code
> 
> 
> Id
> 
> 
> 
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  
>
> The Java code looks like this:
>
> public TestPage(IModel model) {
> super(model);
>
> TestForm tst = new TestForm("testForm", model);
> tst.setOutputMarkupId(true);
> add(tst);
>
> }
>
> class TestForm extends Form {
> /**
> *
> */
> private static final long serialVersionUID = 1L;
>
> public TestForm(String id, IModel model) {
> super(id, model);
>
> List beans = Arrays.asList(new TestBean("Name1", "Code1", 1),
> new TestBean("Name2", "Code2", 2));
> add(new ListView("forEachItem", beans) {
> /**
> *
> */
> private static final long serialVersionUID = 1L;
>
> @Override
> protected void populateItem(ListItem item) {
>   item.add(new Label("itemName", new PropertyModel(item.getModel(),
> "name")));
>   item.add(new Label("itemCode", new PropertyModel(item.getModel(),
> "code")));
>   item.add(new Label("itemId", new PropertyModel(item.getModel(), "id")));
> }
>   });
> }
>
> @Override
> protected void onSubmit() {
>
> logger.info("OnSubmit");
>
> }
> }
>
> The code crashes here because itemId belongs to another row.
> Could you please advise?
>
> Thank you
>
>
>
> On Fri, Oct 14, 2016 at 10:29 AM, Per Newgro  wrote:
>
> > Hello ganea,
> >
> > you can find many information about your problem at
> > http://examples7x.wicket.apache.org/index.html
> > espacially
> > http://examples7x.wicket.apache.org/repeater
> >
> > The user guide can you find here
> > https://ci.apache.org/projects/wicket/guide/7.x/
> > Repeaters are explained here
> > https://ci.apache.org/projects/wicket/guide/7.x/guide/repeaters.html
> >
> > You can add a markup container to a list view item and add the required
> > row components to it.
> >
> > Hope that helps
> > Per
> >
> >
> > Am 14.10.2016 um 09:16 schrieb ganea iulia:
> >
> >> Hello,
> >>
> >> I have in the html file, a table where I need to repeat every two rows.
> >> So, my table is backed by a bean, where the bean values fill 2 rows of
> the
> >> table.
> >> When new bean instance is created, I need to add new 2 rows to the
> table.
> >>
> >> Thank you
> >>
> >>
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>



-- 
Peter Henderson

Director
Starjar Ltd.
www.starjar.com
0330 088 1662


Re: Repeat every 2 rows in a table

2016-10-14 Thread ganea iulia
Hello Per, thank you for the links.

I have following html code:


  



Name
Code


Id



   









 

The Java code looks like this:

public TestPage(IModel model) {
super(model);

TestForm tst = new TestForm("testForm", model);
tst.setOutputMarkupId(true);
add(tst);

}

class TestForm extends Form {
/**
*
*/
private static final long serialVersionUID = 1L;

public TestForm(String id, IModel model) {
super(id, model);

List beans = Arrays.asList(new TestBean("Name1", "Code1", 1),
new TestBean("Name2", "Code2", 2));
add(new ListView("forEachItem", beans) {
/**
*
*/
private static final long serialVersionUID = 1L;

@Override
protected void populateItem(ListItem item) {
  item.add(new Label("itemName", new PropertyModel(item.getModel(),
"name")));
  item.add(new Label("itemCode", new PropertyModel(item.getModel(),
"code")));
  item.add(new Label("itemId", new PropertyModel(item.getModel(), "id")));
}
  });
}

@Override
protected void onSubmit() {

logger.info("OnSubmit");

}
}

The code crashes here because itemId belongs to another row.
Could you please advise?

Thank you



On Fri, Oct 14, 2016 at 10:29 AM, Per Newgro  wrote:

> Hello ganea,
>
> you can find many information about your problem at
> http://examples7x.wicket.apache.org/index.html
> espacially
> http://examples7x.wicket.apache.org/repeater
>
> The user guide can you find here
> https://ci.apache.org/projects/wicket/guide/7.x/
> Repeaters are explained here
> https://ci.apache.org/projects/wicket/guide/7.x/guide/repeaters.html
>
> You can add a markup container to a list view item and add the required
> row components to it.
>
> Hope that helps
> Per
>
>
> Am 14.10.2016 um 09:16 schrieb ganea iulia:
>
>> Hello,
>>
>> I have in the html file, a table where I need to repeat every two rows.
>> So, my table is backed by a bean, where the bean values fill 2 rows of the
>> table.
>> When new bean instance is created, I need to add new 2 rows to the table.
>>
>> Thank you
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Repeat every 2 rows in a table

2016-10-14 Thread Per Newgro

Hello ganea,

you can find many information about your problem at
http://examples7x.wicket.apache.org/index.html
espacially
http://examples7x.wicket.apache.org/repeater

The user guide can you find here
https://ci.apache.org/projects/wicket/guide/7.x/
Repeaters are explained here
https://ci.apache.org/projects/wicket/guide/7.x/guide/repeaters.html

You can add a markup container to a list view item and add the required 
row components to it.


Hope that helps
Per

Am 14.10.2016 um 09:16 schrieb ganea iulia:

Hello,

I have in the html file, a table where I need to repeat every two rows.
So, my table is backed by a bean, where the bean values fill 2 rows of the
table.
When new bean instance is created, I need to add new 2 rows to the table.

Thank you




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



Repeat every 2 rows in a table

2016-10-14 Thread ganea iulia
Hello,

I have in the html file, a table where I need to repeat every two rows.
So, my table is backed by a bean, where the bean values fill 2 rows of the
table.
When new bean instance is created, I need to add new 2 rows to the table.

Thank you