You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by JavaTraveler <me...@gmail.com> on 2018/05/23 14:19:11 UTC

ListView

Hello,

Does anyone know how to update a listView with an ajaxButton, after it's
construction when it was empty ?
For now, I have this :

 final ListView<Piece> pieceView = new ListView<Piece>("pieceView", pieces)
{
			/**
			 * 
			 */
			private static final long serialVersionUID = 1569632937178977468L;

			@Override
			protected void populateItem(ListItem<Piece> item) {
				item.add(new Label("refPiece", new PropertyModel(item.getModel(),
"refPiece")));
			}
		};
		pieceView.setOutputMarkupId(true);

		
		final WebMarkupContainer wmc = new WebMarkupContainer("wmc");
		wmc.setOutputMarkupId(true);
		
		wmc.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));

		wmc.add(pieceView);
		
		
		final AjaxButton button2 = new AjaxButton("rechercheModele"){
			/**
			 * 
			 */
			private static final long serialVersionUID = -4334196093047066924L;

			@Override
			public void onSubmit(AjaxRequestTarget target, Form<?> formF) {
				super.onSubmit(target, formF);
				
				libPieces.clear();
							
				pieces = pieceDAO.getByMod(modeleModel);
				
				for (int i = 0; i < pieces.size(); i++) {
					libPieces.add(i, pieces.get(i).getRefPiece());
				}	
				
				target.add(wmc.add(pieceView));
				
				target.add(piece);
			}



I made something similar with a dropdownchoice which works perfectly. I
guess I'm doing something wrong. But I can't put my finger on it.

Can anyone help me ?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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


Re: ListView

Posted by JavaTraveler <me...@gmail.com>.
Ok, so I managed to pass the piecesModel !
Thank you, it seems to be working :)

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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


Re: ListView

Posted by Sven Meier <sv...@meiers.net>.
Hi,

pass a model with the pieces to the listView, this way it will always renderContexrRelative an up-to-date list.

new ListView("pieceView", piecesModel)

Have fun
Sven

Am 23. Mai 2018 16:19:11 MESZ schrieb JavaTraveler <me...@gmail.com>:
>Hello,
>
>Does anyone know how to update a listView with an ajaxButton, after
>it's
>construction when it was empty ?
>For now, I have this :
>
>final ListView<Piece> pieceView = new ListView<Piece>("pieceView",
>pieces)
>{
>			/**
>			 * 
>			 */
>			private static final long serialVersionUID = 1569632937178977468L;
>
>			@Override
>			protected void populateItem(ListItem<Piece> item) {
>				item.add(new Label("refPiece", new PropertyModel(item.getModel(),
>"refPiece")));
>			}
>		};
>		pieceView.setOutputMarkupId(true);
>
>		
>		final WebMarkupContainer wmc = new WebMarkupContainer("wmc");
>		wmc.setOutputMarkupId(true);
>		
>		wmc.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
>
>		wmc.add(pieceView);
>		
>		
>		final AjaxButton button2 = new AjaxButton("rechercheModele"){
>			/**
>			 * 
>			 */
>			private static final long serialVersionUID = -4334196093047066924L;
>
>			@Override
>			public void onSubmit(AjaxRequestTarget target, Form<?> formF) {
>				super.onSubmit(target, formF);
>				
>				libPieces.clear();
>							
>				pieces = pieceDAO.getByMod(modeleModel);
>				
>				for (int i = 0; i < pieces.size(); i++) {
>					libPieces.add(i, pieces.get(i).getRefPiece());
>				}	
>				
>				target.add(wmc.add(pieceView));
>				
>				target.add(piece);
>			}
>
>
>
>I made something similar with a dropdownchoice which works perfectly. I
>guess I'm doing something wrong. But I can't put my finger on it.
>
>Can anyone help me ?
>
>--
>Sent from:
>http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>For additional commands, e-mail: users-help@wicket.apache.org

RE: ListView

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
Yes, the missing cells show up fine after an F5 page reload. 

> -----Original Message-----
> From: Sven Meier [mailto:sven@meiers.net] 
> Sent: Tuesday, 19 June 2018 5:42 AM
> To: users@wicket.apache.org
> Subject: Re: ListView
> 
> Hi Chris,
> 
> I don't see a reason why your challenge shouldn't work.
> 
> What happens if you reload the page (F5) after adding via 
> Ajax? Do the missing cells show up?
> 
> Have fun
> Sven
> 
> 
> 
> Am 18.06.2018 um 21:26 schrieb Chris Colman:
> > I have an interesting List related challenge - I'm using 
> > RefreshingView and having trouble when adding new rows.
> >
> > The problem is a repeating view within a repeating view
> >
> > i.e.
> >
> > I have a table with two columns.
> > Each row is populated by the RefreshingView.
> >
> > The cells in the right hand column contain their own wicket panel 
> > which contains a sub table with a single column table.
> > This sub table is populated via an inner RefreshingView.
> >
> > Eg.,
> >
> > Col 1   | Col 2
> > ----------------------
> > Name1   | Panel with sub table
> >          | Label 1.1
> >          | Label 1.2
> >          | Label 1.3
> > ----------------------
> > Name 2  | Panel with sub table
> >          | Label 2.1
> >          | Label 2.2
> > -----------------------
> >
> > Etc.
> >
> > Both the outer RefreshingView and the inner view are wrapped in 
> > WebMarkupContainers.
> >
> > The outer refreshing view and each inner refreshing view render 
> > perfectly when the whole page is rendered but I have an Ajax button 
> > that allows users to dynamically add new rows to the top 
> level table 
> > and the new entries don't render correctly.
> >
> > I add the outer RefreshingList's (containing the outer table) 
> > WebMarkupContainer to the Ajax target and Column 1 displays 
> fine but 
> > column 2 is left blank for new entries.
> >
> > Eg., if user adds a new row to above by clicking the Ajax 
> button they
> > see:
> >
> > Col 1   | Col 2
> > ----------------------
> > Name1   | Panel with sub table
> >          | Label 1.1
> >          | Label 1.2
> >          | Label 1.3
> > ----------------------
> > Name 2  | Panel with sub table
> >          | Label 2.1
> >          | Label 2.2
> > -----------------------
> > Name 3  |
> > -----------------------
> >
> > I have set reuse strategy for both inner and outer 
> RefressingViewS via:
> >
> >
> > 	setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
> >
> > Debugging reveals that a new inner panel is constructed and its 
> > onInitialize method is called, however, the populateItem method is 
> > never called for it's inner RefreshingView.
> >
> > Is there something I've missed to cause the populateItem 
> method to be 
> > called to populate the new row fully or am I pushing the limits of 
> > what the RefreshingView was designed for by nesting them like this?
> >
> >> -----Original Message-----
> >> From: Martin Grigorov [mailto:mgrigorov@apache.org]
> >> Sent: Friday, 25 May 2018 8:12 AM
> >> To: users@wicket.apache.org
> >> Subject: Re: ListView
> >>
> >> On Thu, May 24, 2018 at 2:01 PM, JavaTraveler 
> >> <me...@gmail.com>
> >> wrote:
> >>
> >>> Quickstart ?
> >>>
> >> a mini application showing the problem 
> >> https://wicket.apache.org/start/quickstart.html
> >>
> >>
> >>> --
> >>> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> >>> f1842947.html
> >>>
> >>>
> >> 
> ---------------------------------------------------------------------
> >>> 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
> >
> 
> 
> ---------------------------------------------------------------------
> 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


RE: ListView

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
Problem solved - my bad!

After some detailed debugging it looks like the new model object had not
yet been persisted properly so the query to retrieve its values had
returned no results meaning that the model list was left empty...

So once again - an issue with how I wired up the underlying model
persistence and not an issue with the best Java UI framework in the
world!

Regards,
Chris

> -----Original Message-----
> From: Sven Meier [mailto:sven@meiers.net] 
> Sent: Tuesday, 19 June 2018 5:42 AM
> To: users@wicket.apache.org
> Subject: Re: ListView
> 
> Hi Chris,
> 
> I don't see a reason why your challenge shouldn't work.
> 
> What happens if you reload the page (F5) after adding via 
> Ajax? Do the missing cells show up?
> 
> Have fun
> Sven
> 
> 
> 
> Am 18.06.2018 um 21:26 schrieb Chris Colman:
> > I have an interesting List related challenge - I'm using 
> > RefreshingView and having trouble when adding new rows.
> >
> > The problem is a repeating view within a repeating view
> >
> > i.e.
> >
> > I have a table with two columns.
> > Each row is populated by the RefreshingView.
> >
> > The cells in the right hand column contain their own wicket panel 
> > which contains a sub table with a single column table.
> > This sub table is populated via an inner RefreshingView.
> >
> > Eg.,
> >
> > Col 1   | Col 2
> > ----------------------
> > Name1   | Panel with sub table
> >          | Label 1.1
> >          | Label 1.2
> >          | Label 1.3
> > ----------------------
> > Name 2  | Panel with sub table
> >          | Label 2.1
> >          | Label 2.2
> > -----------------------
> >
> > Etc.
> >
> > Both the outer RefreshingView and the inner view are wrapped in 
> > WebMarkupContainers.
> >
> > The outer refreshing view and each inner refreshing view render 
> > perfectly when the whole page is rendered but I have an Ajax button 
> > that allows users to dynamically add new rows to the top 
> level table 
> > and the new entries don't render correctly.
> >
> > I add the outer RefreshingList's (containing the outer table) 
> > WebMarkupContainer to the Ajax target and Column 1 displays 
> fine but 
> > column 2 is left blank for new entries.
> >
> > Eg., if user adds a new row to above by clicking the Ajax 
> button they
> > see:
> >
> > Col 1   | Col 2
> > ----------------------
> > Name1   | Panel with sub table
> >          | Label 1.1
> >          | Label 1.2
> >          | Label 1.3
> > ----------------------
> > Name 2  | Panel with sub table
> >          | Label 2.1
> >          | Label 2.2
> > -----------------------
> > Name 3  |
> > -----------------------
> >
> > I have set reuse strategy for both inner and outer 
> RefressingViewS via:
> >
> >
> > 	setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
> >
> > Debugging reveals that a new inner panel is constructed and its 
> > onInitialize method is called, however, the populateItem method is 
> > never called for it's inner RefreshingView.
> >
> > Is there something I've missed to cause the populateItem 
> method to be 
> > called to populate the new row fully or am I pushing the limits of 
> > what the RefreshingView was designed for by nesting them like this?
> >
> >> -----Original Message-----
> >> From: Martin Grigorov [mailto:mgrigorov@apache.org]
> >> Sent: Friday, 25 May 2018 8:12 AM
> >> To: users@wicket.apache.org
> >> Subject: Re: ListView
> >>
> >> On Thu, May 24, 2018 at 2:01 PM, JavaTraveler 
> >> <me...@gmail.com>
> >> wrote:
> >>
> >>> Quickstart ?
> >>>
> >> a mini application showing the problem 
> >> https://wicket.apache.org/start/quickstart.html
> >>
> >>
> >>> --
> >>> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> >>> f1842947.html
> >>>
> >>>
> >> 
> ---------------------------------------------------------------------
> >>> 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
> >
> 
> 
> ---------------------------------------------------------------------
> 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


RE: ListView

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
You are right - it turns out it was a detach problem and not a problem
with persisting the new object as I had initially assumed - this detach
problem was the reason why the query in the ORM returned no values for
the new object.

We use our Javelin tool to visually generate and manage wicket UI
classes. For the particular diagram that these new UI classes were in I
had neglected to configure it for "GUI classes bound to domain objects"
so it creates direct references to the domain objects instead of using
indirect 'model referencing' (IModel) classes - doh! Hence proper
detachment of these model objects was nor occuring.

Thanks for your help Sven.

> -----Original Message-----
> From: Sven Meier [mailto:sven@meiers.net] 
> Sent: Tuesday, 19 June 2018 6:25 AM
> To: users@wicket.apache.org
> Subject: Re: ListView
> 
> Adding the outer one should be sufficient.
> 
> I'd guess that you have a detach problem:
> During rendering of the Ajax response your inner 
> refreshingView is iterating over stale data, i.e. an empty list.
> Only after the following detach (e.g. when the page is 
> requested anew) it shows the actual data.
> 
> Have fun
> Sven
> 
> 
> Am 18.06.2018 um 22:11 schrieb Chris Colman:
> > Is a single ajaxtarget.add(outerWebMarkupContainer) 
> sufficient or do I 
> > somehow have to locate the inner WebMarkupContainer in the 
> right hand 
> > cell in the new row and add it to the Ajax target as well?
> >
> >> -----Original Message-----
> >> From: Sven Meier [mailto:sven@meiers.net]
> >> Sent: Tuesday, 19 June 2018 5:42 AM
> >> To: users@wicket.apache.org
> >> Subject: Re: ListView
> >>
> >> Hi Chris,
> >>
> >> I don't see a reason why your challenge shouldn't work.
> >>
> >> What happens if you reload the page (F5) after adding via Ajax? Do 
> >> the missing cells show up?
> >>
> >> Have fun
> >> Sven
> >>
> >>
> >>
> >> Am 18.06.2018 um 21:26 schrieb Chris Colman:
> >>> I have an interesting List related challenge - I'm using 
> >>> RefreshingView and having trouble when adding new rows.
> >>>
> >>> The problem is a repeating view within a repeating view
> >>>
> >>> i.e.
> >>>
> >>> I have a table with two columns.
> >>> Each row is populated by the RefreshingView.
> >>>
> >>> The cells in the right hand column contain their own wicket panel 
> >>> which contains a sub table with a single column table.
> >>> This sub table is populated via an inner RefreshingView.
> >>>
> >>> Eg.,
> >>>
> >>> Col 1   | Col 2
> >>> ----------------------
> >>> Name1   | Panel with sub table
> >>>           | Label 1.1
> >>>           | Label 1.2
> >>>           | Label 1.3
> >>> ----------------------
> >>> Name 2  | Panel with sub table
> >>>           | Label 2.1
> >>>           | Label 2.2
> >>> -----------------------
> >>>
> >>> Etc.
> >>>
> >>> Both the outer RefreshingView and the inner view are wrapped in 
> >>> WebMarkupContainers.
> >>>
> >>> The outer refreshing view and each inner refreshing view render 
> >>> perfectly when the whole page is rendered but I have an 
> Ajax button 
> >>> that allows users to dynamically add new rows to the top
> >> level table
> >>> and the new entries don't render correctly.
> >>>
> >>> I add the outer RefreshingList's (containing the outer table) 
> >>> WebMarkupContainer to the Ajax target and Column 1 displays
> >> fine but
> >>> column 2 is left blank for new entries.
> >>>
> >>> Eg., if user adds a new row to above by clicking the Ajax
> >> button they
> >>> see:
> >>>
> >>> Col 1   | Col 2
> >>> ----------------------
> >>> Name1   | Panel with sub table
> >>>           | Label 1.1
> >>>           | Label 1.2
> >>>           | Label 1.3
> >>> ----------------------
> >>> Name 2  | Panel with sub table
> >>>           | Label 2.1
> >>>           | Label 2.2
> >>> -----------------------
> >>> Name 3  |
> >>> -----------------------
> >>>
> >>> I have set reuse strategy for both inner and outer
> >> RefressingViewS via:
> >>>
> >>> 	setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
> >>>
> >>> Debugging reveals that a new inner panel is constructed and its 
> >>> onInitialize method is called, however, the populateItem 
> method is 
> >>> never called for it's inner RefreshingView.
> >>>
> >>> Is there something I've missed to cause the populateItem
> >> method to be
> >>> called to populate the new row fully or am I pushing the 
> limits of 
> >>> what the RefreshingView was designed for by nesting them 
> like this?
> >>>
> >>>> -----Original Message-----
> >>>> From: Martin Grigorov [mailto:mgrigorov@apache.org]
> >>>> Sent: Friday, 25 May 2018 8:12 AM
> >>>> To: users@wicket.apache.org
> >>>> Subject: Re: ListView
> >>>>
> >>>> On Thu, May 24, 2018 at 2:01 PM, JavaTraveler 
> >>>> <me...@gmail.com>
> >>>> wrote:
> >>>>
> >>>>> Quickstart ?
> >>>>>
> >>>> a mini application showing the problem 
> >>>> https://wicket.apache.org/start/quickstart.html
> >>>>
> >>>>
> >>>>> --
> >>>>> Sent from: 
> http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> >>>>> f1842947.html
> >>>>>
> >>>>>
> >> 
> ---------------------------------------------------------------------
> >>>>> 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
> >>>
> >>
> >> 
> ---------------------------------------------------------------------
> >> 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
> >
> 
> 
> ---------------------------------------------------------------------
> 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


Re: ListView

Posted by Sven Meier <sv...@meiers.net>.
Adding the outer one should be sufficient.

I'd guess that you have a detach problem:
During rendering of the Ajax response your inner refreshingView is 
iterating over stale data, i.e. an empty list.
Only after the following detach (e.g. when the page is requested anew) 
it shows the actual data.

Have fun
Sven


Am 18.06.2018 um 22:11 schrieb Chris Colman:
> Is a single ajaxtarget.add(outerWebMarkupContainer) sufficient or do I
> somehow have to locate the inner WebMarkupContainer in the right hand
> cell in the new row and add it to the Ajax target as well?
>
>> -----Original Message-----
>> From: Sven Meier [mailto:sven@meiers.net]
>> Sent: Tuesday, 19 June 2018 5:42 AM
>> To: users@wicket.apache.org
>> Subject: Re: ListView
>>
>> Hi Chris,
>>
>> I don't see a reason why your challenge shouldn't work.
>>
>> What happens if you reload the page (F5) after adding via
>> Ajax? Do the missing cells show up?
>>
>> Have fun
>> Sven
>>
>>
>>
>> Am 18.06.2018 um 21:26 schrieb Chris Colman:
>>> I have an interesting List related challenge - I'm using
>>> RefreshingView and having trouble when adding new rows.
>>>
>>> The problem is a repeating view within a repeating view
>>>
>>> i.e.
>>>
>>> I have a table with two columns.
>>> Each row is populated by the RefreshingView.
>>>
>>> The cells in the right hand column contain their own wicket panel
>>> which contains a sub table with a single column table.
>>> This sub table is populated via an inner RefreshingView.
>>>
>>> Eg.,
>>>
>>> Col 1   | Col 2
>>> ----------------------
>>> Name1   | Panel with sub table
>>>           | Label 1.1
>>>           | Label 1.2
>>>           | Label 1.3
>>> ----------------------
>>> Name 2  | Panel with sub table
>>>           | Label 2.1
>>>           | Label 2.2
>>> -----------------------
>>>
>>> Etc.
>>>
>>> Both the outer RefreshingView and the inner view are wrapped in
>>> WebMarkupContainers.
>>>
>>> The outer refreshing view and each inner refreshing view render
>>> perfectly when the whole page is rendered but I have an Ajax button
>>> that allows users to dynamically add new rows to the top
>> level table
>>> and the new entries don't render correctly.
>>>
>>> I add the outer RefreshingList's (containing the outer table)
>>> WebMarkupContainer to the Ajax target and Column 1 displays
>> fine but
>>> column 2 is left blank for new entries.
>>>
>>> Eg., if user adds a new row to above by clicking the Ajax
>> button they
>>> see:
>>>
>>> Col 1   | Col 2
>>> ----------------------
>>> Name1   | Panel with sub table
>>>           | Label 1.1
>>>           | Label 1.2
>>>           | Label 1.3
>>> ----------------------
>>> Name 2  | Panel with sub table
>>>           | Label 2.1
>>>           | Label 2.2
>>> -----------------------
>>> Name 3  |
>>> -----------------------
>>>
>>> I have set reuse strategy for both inner and outer
>> RefressingViewS via:
>>>
>>> 	setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
>>>
>>> Debugging reveals that a new inner panel is constructed and its
>>> onInitialize method is called, however, the populateItem method is
>>> never called for it's inner RefreshingView.
>>>
>>> Is there something I've missed to cause the populateItem
>> method to be
>>> called to populate the new row fully or am I pushing the limits of
>>> what the RefreshingView was designed for by nesting them like this?
>>>
>>>> -----Original Message-----
>>>> From: Martin Grigorov [mailto:mgrigorov@apache.org]
>>>> Sent: Friday, 25 May 2018 8:12 AM
>>>> To: users@wicket.apache.org
>>>> Subject: Re: ListView
>>>>
>>>> On Thu, May 24, 2018 at 2:01 PM, JavaTraveler
>>>> <me...@gmail.com>
>>>> wrote:
>>>>
>>>>> Quickstart ?
>>>>>
>>>> a mini application showing the problem
>>>> https://wicket.apache.org/start/quickstart.html
>>>>
>>>>
>>>>> --
>>>>> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
>>>>> f1842947.html
>>>>>
>>>>>
>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>


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


RE: ListView

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
Is a single ajaxtarget.add(outerWebMarkupContainer) sufficient or do I
somehow have to locate the inner WebMarkupContainer in the right hand
cell in the new row and add it to the Ajax target as well?

> -----Original Message-----
> From: Sven Meier [mailto:sven@meiers.net] 
> Sent: Tuesday, 19 June 2018 5:42 AM
> To: users@wicket.apache.org
> Subject: Re: ListView
> 
> Hi Chris,
> 
> I don't see a reason why your challenge shouldn't work.
> 
> What happens if you reload the page (F5) after adding via 
> Ajax? Do the missing cells show up?
> 
> Have fun
> Sven
> 
> 
> 
> Am 18.06.2018 um 21:26 schrieb Chris Colman:
> > I have an interesting List related challenge - I'm using 
> > RefreshingView and having trouble when adding new rows.
> >
> > The problem is a repeating view within a repeating view
> >
> > i.e.
> >
> > I have a table with two columns.
> > Each row is populated by the RefreshingView.
> >
> > The cells in the right hand column contain their own wicket panel 
> > which contains a sub table with a single column table.
> > This sub table is populated via an inner RefreshingView.
> >
> > Eg.,
> >
> > Col 1   | Col 2
> > ----------------------
> > Name1   | Panel with sub table
> >          | Label 1.1
> >          | Label 1.2
> >          | Label 1.3
> > ----------------------
> > Name 2  | Panel with sub table
> >          | Label 2.1
> >          | Label 2.2
> > -----------------------
> >
> > Etc.
> >
> > Both the outer RefreshingView and the inner view are wrapped in 
> > WebMarkupContainers.
> >
> > The outer refreshing view and each inner refreshing view render 
> > perfectly when the whole page is rendered but I have an Ajax button 
> > that allows users to dynamically add new rows to the top 
> level table 
> > and the new entries don't render correctly.
> >
> > I add the outer RefreshingList's (containing the outer table) 
> > WebMarkupContainer to the Ajax target and Column 1 displays 
> fine but 
> > column 2 is left blank for new entries.
> >
> > Eg., if user adds a new row to above by clicking the Ajax 
> button they
> > see:
> >
> > Col 1   | Col 2
> > ----------------------
> > Name1   | Panel with sub table
> >          | Label 1.1
> >          | Label 1.2
> >          | Label 1.3
> > ----------------------
> > Name 2  | Panel with sub table
> >          | Label 2.1
> >          | Label 2.2
> > -----------------------
> > Name 3  |
> > -----------------------
> >
> > I have set reuse strategy for both inner and outer 
> RefressingViewS via:
> >
> >
> > 	setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
> >
> > Debugging reveals that a new inner panel is constructed and its 
> > onInitialize method is called, however, the populateItem method is 
> > never called for it's inner RefreshingView.
> >
> > Is there something I've missed to cause the populateItem 
> method to be 
> > called to populate the new row fully or am I pushing the limits of 
> > what the RefreshingView was designed for by nesting them like this?
> >
> >> -----Original Message-----
> >> From: Martin Grigorov [mailto:mgrigorov@apache.org]
> >> Sent: Friday, 25 May 2018 8:12 AM
> >> To: users@wicket.apache.org
> >> Subject: Re: ListView
> >>
> >> On Thu, May 24, 2018 at 2:01 PM, JavaTraveler 
> >> <me...@gmail.com>
> >> wrote:
> >>
> >>> Quickstart ?
> >>>
> >> a mini application showing the problem 
> >> https://wicket.apache.org/start/quickstart.html
> >>
> >>
> >>> --
> >>> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> >>> f1842947.html
> >>>
> >>>
> >> 
> ---------------------------------------------------------------------
> >>> 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
> >
> 
> 
> ---------------------------------------------------------------------
> 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


Re: ListView

Posted by Sven Meier <sv...@meiers.net>.
Hi Chris,

I don't see a reason why your challenge shouldn't work.

What happens if you reload the page (F5) after adding via Ajax? Do the 
missing cells show up?

Have fun
Sven



Am 18.06.2018 um 21:26 schrieb Chris Colman:
> I have an interesting List related challenge - I'm using RefreshingView
> and having trouble when adding new rows.
>
> The problem is a repeating view within a repeating view
>
> i.e.
>
> I have a table with two columns.
> Each row is populated by the RefreshingView.
>
> The cells in the right hand column contain their own wicket panel which
> contains a sub table with a single column table.
> This sub table is populated via an inner RefreshingView.
>
> Eg.,
>
> Col 1   | Col 2
> ----------------------
> Name1   | Panel with sub table
>          | Label 1.1
>          | Label 1.2
>          | Label 1.3
> ----------------------
> Name 2  | Panel with sub table
>          | Label 2.1
>          | Label 2.2
> -----------------------
>
> Etc.
>
> Both the outer RefreshingView and the inner view are wrapped in
> WebMarkupContainers.
>
> The outer refreshing view and each inner refreshing view render
> perfectly when the whole page is rendered but I have an Ajax button that
> allows users to dynamically add new rows to the top level table and the
> new entries don't render correctly.
>
> I add the outer RefreshingList's (containing the outer table)
> WebMarkupContainer to the Ajax target and Column 1 displays fine but
> column 2 is left blank for new entries.
>
> Eg., if user adds a new row to above by clicking the Ajax button they
> see:
>
> Col 1   | Col 2
> ----------------------
> Name1   | Panel with sub table
>          | Label 1.1
>          | Label 1.2
>          | Label 1.3
> ----------------------
> Name 2  | Panel with sub table
>          | Label 2.1
>          | Label 2.2
> -----------------------
> Name 3  |
> -----------------------
>
> I have set reuse strategy for both inner and outer RefressingViewS via:
>
>
> 	setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
>
> Debugging reveals that a new inner panel is constructed and its
> onInitialize method is called, however, the populateItem method is never
> called for it's inner RefreshingView.
>
> Is there something I've missed to cause the populateItem method to be
> called to populate the new row fully or am I pushing the limits of what
> the RefreshingView was designed for by nesting them like this?
>
>> -----Original Message-----
>> From: Martin Grigorov [mailto:mgrigorov@apache.org]
>> Sent: Friday, 25 May 2018 8:12 AM
>> To: users@wicket.apache.org
>> Subject: Re: ListView
>>
>> On Thu, May 24, 2018 at 2:01 PM, JavaTraveler <me...@gmail.com>
>> wrote:
>>
>>> Quickstart ?
>>>
>> a mini application showing the problem
>> https://wicket.apache.org/start/quickstart.html
>>
>>
>>> --
>>> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
>>> f1842947.html
>>>
>>>
>> ---------------------------------------------------------------------
>>> 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
>


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


RE: ListView

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
I have an interesting List related challenge - I'm using RefreshingView
and having trouble when adding new rows.

The problem is a repeating view within a repeating view

i.e.

I have a table with two columns.
Each row is populated by the RefreshingView.

The cells in the right hand column contain their own wicket panel which
contains a sub table with a single column table.
This sub table is populated via an inner RefreshingView.

Eg.,

Col 1   | Col 2
----------------------
Name1   | Panel with sub table
        | Label 1.1
        | Label 1.2
        | Label 1.3
----------------------
Name 2  | Panel with sub table
        | Label 2.1
        | Label 2.2
-----------------------

Etc.

Both the outer RefreshingView and the inner view are wrapped in
WebMarkupContainers.

The outer refreshing view and each inner refreshing view render
perfectly when the whole page is rendered but I have an Ajax button that
allows users to dynamically add new rows to the top level table and the
new entries don't render correctly.

I add the outer RefreshingList's (containing the outer table)
WebMarkupContainer to the Ajax target and Column 1 displays fine but
column 2 is left blank for new entries.

Eg., if user adds a new row to above by clicking the Ajax button they
see:

Col 1   | Col 2
----------------------
Name1   | Panel with sub table
        | Label 1.1
        | Label 1.2
        | Label 1.3
----------------------
Name 2  | Panel with sub table
        | Label 2.1
        | Label 2.2
-----------------------
Name 3  | 
-----------------------

I have set reuse strategy for both inner and outer RefressingViewS via:


	setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());

Debugging reveals that a new inner panel is constructed and its
onInitialize method is called, however, the populateItem method is never
called for it's inner RefreshingView.

Is there something I've missed to cause the populateItem method to be
called to populate the new row fully or am I pushing the limits of what
the RefreshingView was designed for by nesting them like this?

> -----Original Message-----
> From: Martin Grigorov [mailto:mgrigorov@apache.org] 
> Sent: Friday, 25 May 2018 8:12 AM
> To: users@wicket.apache.org
> Subject: Re: ListView
> 
> On Thu, May 24, 2018 at 2:01 PM, JavaTraveler <me...@gmail.com>
> wrote:
> 
> > Quickstart ?
> >
> 
> a mini application showing the problem
> https://wicket.apache.org/start/quickstart.html
> 
> 
> >
> > --
> > Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> > f1842947.html
> >
> > 
> ---------------------------------------------------------------------
> > 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


Re: ListView

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, May 24, 2018 at 2:01 PM, JavaTraveler <me...@gmail.com>
wrote:

> Quickstart ?
>

a mini application showing the problem
https://wicket.apache.org/start/quickstart.html


>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: ListView

Posted by JavaTraveler <me...@gmail.com>.
Quickstart ?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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


AW: ListView

Posted by "Drummer, Matthias" <ma...@iqtig.org>.
Hi,

here some example code for refreshing a listView via an AjaxButton if I understood you right. Perhaps it will help you.

Things to note:
- add the WebMarkupContainer to the AjaxRequestTarget (target.add(..)) not the ListView itself because this will not work. You tried something like that in your example code.

public class TestPage extends WebPage {

    @Override
    protected void onInitialize() {
        super.onInitialize();

        final List<String> pieces = new ArrayList<>();

        final WebMarkupContainer listViewContainer = new WebMarkupContainer("listViewContainer");
        listViewContainer.setOutputMarkupId(true);

        listViewContainer.add(new ListView<String>("listView", Model.ofList(pieces)) {
            @Override
            protected void populateItem(ListItem<String> item) {
                item.add(new Label("rowItem", item.getModel()));
            }
        });

        add(listViewContainer);

        final Form<Void> form = new Form<>("testForm");
        add(form);

        form.add(new AjaxButton("refreshBtn") {

            int count = 0;
            @Override
            protected void onSubmit(AjaxRequestTarget target) {
                super.onSubmit(target);

                // click adds a new rowItem
                pieces.add("Row Item String " + count);
                count++;

                target.add(listViewContainer); // refresh the surrounding div container
            }
        });
    }
}

<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<head>
    <meta charset="UTF-8">
    <title>Test</title>
</head>
<body>
<div wicket:id="listViewContainer">
    <h2>ListView Container</h2>
    <div wicket:id="listView">
        <span wicket:id="rowItem">[RowItem]</span>
    </div>
</div>
<form wicket:id="testForm">
    <input type="button" wicket:id="refreshBtn" value="Refresh ListView"/>
</form>
</body>
</html>

Greetings Matthias

-----Ursprüngliche Nachricht-----
Von: Maxim Solodovnik [mailto:solomax666@gmail.com] 
Gesendet: Donnerstag, 24. Mai 2018 12:32
An: users@wicket.apache.org
Betreff: Re: ListView

Could you share quickstart?

WBR, Maxim
(from mobile, sorry for the typos)

On Thu, May 24, 2018, 17:28 JavaTraveler <me...@gmail.com> wrote:

> Hello !
>
> So no sorry, it does not work.
> The solution of Maxim does nothing different.
> And the one from Sven makes a mistake since my ListView needs a list 
> of pieces, and pieceModel is just a Piece.
>
> Any other solutions ?
>
> --
> Sent from:
> http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: ListView

Posted by Maxim Solodovnik <so...@gmail.com>.
Could you share quickstart?

WBR, Maxim
(from mobile, sorry for the typos)

On Thu, May 24, 2018, 17:28 JavaTraveler <me...@gmail.com> wrote:

> Hello !
>
> So no sorry, it does not work.
> The solution of Maxim does nothing different.
> And the one from Sven makes a mistake since my ListView needs a list of
> pieces, and pieceModel is just a Piece.
>
> Any other solutions ?
>
> --
> Sent from:
> http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: ListView

Posted by JavaTraveler <me...@gmail.com>.
Hello !

So no sorry, it does not work.
The solution of Maxim does nothing different.
And the one from Sven makes a mistake since my ListView needs a list of
pieces, and pieceModel is just a Piece.

Any other solutions ?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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


Re: ListView

Posted by Maxim Solodovnik <so...@gmail.com>.
You need to change your code a little:

1) pieceView.setOutputMarkupId(true); is not necessary
2) target.add(wmc); instead of target.add(wmc.add(pieceView));

should work as expected :)

On Wed, May 23, 2018 at 9:19 PM, JavaTraveler <me...@gmail.com> wrote:
> Hello,
>
> Does anyone know how to update a listView with an ajaxButton, after it's
> construction when it was empty ?
> For now, I have this :
>
>  final ListView<Piece> pieceView = new ListView<Piece>("pieceView", pieces)
> {
>                         /**
>                          *
>                          */
>                         private static final long serialVersionUID = 1569632937178977468L;
>
>                         @Override
>                         protected void populateItem(ListItem<Piece> item) {
>                                 item.add(new Label("refPiece", new PropertyModel(item.getModel(),
> "refPiece")));
>                         }
>                 };
>                 pieceView.setOutputMarkupId(true);
>
>
>                 final WebMarkupContainer wmc = new WebMarkupContainer("wmc");
>                 wmc.setOutputMarkupId(true);
>
>                 wmc.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
>
>                 wmc.add(pieceView);
>
>
>                 final AjaxButton button2 = new AjaxButton("rechercheModele"){
>                         /**
>                          *
>                          */
>                         private static final long serialVersionUID = -4334196093047066924L;
>
>                         @Override
>                         public void onSubmit(AjaxRequestTarget target, Form<?> formF) {
>                                 super.onSubmit(target, formF);
>
>                                 libPieces.clear();
>
>                                 pieces = pieceDAO.getByMod(modeleModel);
>
>                                 for (int i = 0; i < pieces.size(); i++) {
>                                         libPieces.add(i, pieces.get(i).getRefPiece());
>                                 }
>
>                                 target.add(wmc.add(pieceView));
>
>                                 target.add(piece);
>                         }
>
>
>
> I made something similar with a dropdownchoice which works perfectly. I
> guess I'm doing something wrong. But I can't put my finger on it.
>
> Can anyone help me ?
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
WBR
Maxim aka solomax

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