Discussion:
ListView
JavaTraveler
2018-05-23 14:19:11 UTC
Permalink
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-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Maxim Solodovnik
2018-05-23 15:56:49 UTC
Permalink
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 :)
Post by JavaTraveler
Hello,
Does anyone know how to update a listView with an ajaxButton, after it's
construction when it was empty ?
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
---------------------------------------------------------------------
--
WBR
Maxim aka solomax

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
JavaTraveler
2018-05-24 07:26:18 UTC
Permalink
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-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Maxim Solodovnik
2018-05-24 10:32:06 UTC
Permalink
Could you share quickstart?

WBR, Maxim
(from mobile, sorry for the typos)
Post by JavaTraveler
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 ?
--
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
Drummer, Matthias
2018-05-24 11:34:35 UTC
Permalink
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:***@gmail.com]
Gesendet: Donnerstag, 24. Mai 2018 12:32
An: ***@wicket.apache.org
Betreff: Re: ListView

Could you share quickstart?

WBR, Maxim
(from mobile, sorry for the typos)
Post by JavaTraveler
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 ?
--
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[�\�\��][��X��ܚX�P�X��] �\X�K�ܙ�B��܈Y][ۘ[��[X[��K[
JavaTraveler
2018-05-24 11:01:31 UTC
Permalink
Quickstart ?

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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Martin Grigorov
2018-05-24 22:12:20 UTC
Permalink
Post by JavaTraveler
Quickstart ?
a mini application showing the problem
https://wicket.apache.org/start/quickstart.html
Post by JavaTraveler
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
f1842947.html
---------------------------------------------------------------------
Chris Colman
2018-06-18 19:26:26 UTC
Permalink
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-----
Sent: Friday, 25 May 2018 8:12 AM
Subject: Re: ListView
Post by JavaTraveler
Quickstart ?
a mini application showing the problem
https://wicket.apache.org/start/quickstart.html
Post by JavaTraveler
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
f1842947.html
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Sven Meier
2018-06-18 19:42:09 UTC
Permalink
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
Post by 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
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 |
-----------------------
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-----
Sent: Friday, 25 May 2018 8:12 AM
Subject: Re: ListView
Post by JavaTraveler
Quickstart ?
a mini application showing the problem
https://wicket.apache.org/start/quickstart.html
Post by JavaTraveler
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
f1842947.html
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Chris Colman
2018-06-18 19:47:06 UTC
Permalink
Yes, the missing cells show up fine after an F5 page reload.
-----Original Message-----
Sent: Tuesday, 19 June 2018 5:42 AM
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
Post by 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
Post by Chris Colman
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
Post by Chris Colman
column 2 is left blank for new entries.
Eg., if user adds a new row to above by clicking the Ajax
button they
Post by Chris Colman
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
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
Post by Chris Colman
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-----
Sent: Friday, 25 May 2018 8:12 AM
Subject: Re: ListView
On Thu, May 24, 2018 at 2:01 PM, JavaTraveler
Post by JavaTraveler
Quickstart ?
a mini application showing the problem
https://wicket.apache.org/start/quickstart.html
Post by JavaTraveler
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
f1842947.html
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Chris Colman
2018-06-18 20:11:20 UTC
Permalink
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-----
Sent: Tuesday, 19 June 2018 5:42 AM
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
Post by 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
Post by Chris Colman
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
Post by Chris Colman
column 2 is left blank for new entries.
Eg., if user adds a new row to above by clicking the Ajax
button they
Post by Chris Colman
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
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
Post by Chris Colman
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-----
Sent: Friday, 25 May 2018 8:12 AM
Subject: Re: ListView
On Thu, May 24, 2018 at 2:01 PM, JavaTraveler
Post by JavaTraveler
Quickstart ?
a mini application showing the problem
https://wicket.apache.org/start/quickstart.html
Post by JavaTraveler
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
f1842947.html
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Sven Meier
2018-06-18 20:24:49 UTC
Permalink
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
Post by 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-----
Sent: Tuesday, 19 June 2018 5:42 AM
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
Post by 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
Post by Chris Colman
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
Post by Chris Colman
column 2 is left blank for new entries.
Eg., if user adds a new row to above by clicking the Ajax
button they
Post by Chris Colman
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
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
Post by Chris Colman
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-----
Sent: Friday, 25 May 2018 8:12 AM
Subject: Re: ListView
On Thu, May 24, 2018 at 2:01 PM, JavaTraveler
Post by JavaTraveler
Quickstart ?
a mini application showing the problem
https://wicket.apache.org/start/quickstart.html
Post by JavaTraveler
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
f1842947.html
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Chris Colman
2018-06-18 20:36:18 UTC
Permalink
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-----
Sent: Tuesday, 19 June 2018 6:25 AM
Subject: Re: ListView
Adding the outer one should be sufficient.
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
Post by Chris Colman
Is a single ajaxtarget.add(outerWebMarkupContainer)
sufficient or do I
Post by Chris Colman
somehow have to locate the inner WebMarkupContainer in the
right hand
Post by Chris Colman
cell in the new row and add it to the Ajax target as well?
-----Original Message-----
Sent: Tuesday, 19 June 2018 5:42 AM
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
Post by 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
Post by Chris Colman
Post by Chris Colman
that allows users to dynamically add new rows to the top
level table
Post by Chris Colman
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
Post by Chris Colman
column 2 is left blank for new entries.
Eg., if user adds a new row to above by clicking the Ajax
button they
Post by Chris Colman
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
setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
Debugging reveals that a new inner panel is constructed and its
onInitialize method is called, however, the populateItem
method is
Post by Chris Colman
Post by Chris Colman
never called for it's inner RefreshingView.
Is there something I've missed to cause the populateItem
method to be
Post by Chris Colman
called to populate the new row fully or am I pushing the
limits of
Post by Chris Colman
Post by Chris Colman
what the RefreshingView was designed for by nesting them
like this?
Post by Chris Colman
Post by Chris Colman
-----Original Message-----
Sent: Friday, 25 May 2018 8:12 AM
Subject: Re: ListView
On Thu, May 24, 2018 at 2:01 PM, JavaTraveler
Post by JavaTraveler
Quickstart ?
a mini application showing the problem
https://wicket.apache.org/start/quickstart.html
Post by JavaTraveler
--
http://apache-wicket.1842946.n4.nabble.com/Users-forum-
Post by Chris Colman
Post by Chris Colman
Post by JavaTraveler
f1842947.html
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org

Chris Colman
2018-06-18 20:24:55 UTC
Permalink
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-----
Sent: Tuesday, 19 June 2018 5:42 AM
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
Post by 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
Post by Chris Colman
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
Post by Chris Colman
column 2 is left blank for new entries.
Eg., if user adds a new row to above by clicking the Ajax
button they
Post by Chris Colman
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
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
Post by Chris Colman
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-----
Sent: Friday, 25 May 2018 8:12 AM
Subject: Re: ListView
On Thu, May 24, 2018 at 2:01 PM, JavaTraveler
Post by JavaTraveler
Quickstart ?
a mini application showing the problem
https://wicket.apache.org/start/quickstart.html
Post by JavaTraveler
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
f1842947.html
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Sven Meier
2018-05-23 16:44:58 UTC
Permalink
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
Post by JavaTraveler
Hello,
Does anyone know how to update a listView with an ajaxButton, after it's
construction when it was empty ?
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 ?
--
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
JavaTraveler
2018-05-24 08:39:30 UTC
Permalink
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-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Loading...