RE: ListView
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:s...@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:s...@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: > >>> >
RE: ListView
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:s...@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:mgrigo...@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 > >> > >> 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-unsubscr...@wicket.apache.org > >>> For additional commands, e-mail: users-h...@wicket.apache.org > >>> > >>> > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
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:s...@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:mgrigo...@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 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-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: ListView
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:s...@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:mgrigo...@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 > >> > >> 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-unsubscr...@wicket.apache.org > >>> For additional commands, e-mail: users-h...@wicket.apache.org > >>> > >>> > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: ListView
Yes, the missing cells show up fine after an F5 page reload. > -Original Message- > From: Sven Meier [mailto:s...@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:mgrigo...@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 > >> > >> 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-unsubscr...@wicket.apache.org > >>> For additional commands, e-mail: users-h...@wicket.apache.org > >>> > >>> > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
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:mgrigo...@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 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-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: ListView
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:mgrigo...@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 > 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-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView
On Thu, May 24, 2018 at 2:01 PM, JavaTravelerwrote: > 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-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: ListView
Quickstart ? -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView
Could you share quickstart? WBR, Maxim (from mobile, sorry for the typos) On Thu, May 24, 2018, 17:28 JavaTravelerwrote: > 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-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: ListView
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-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView
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-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView
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: >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 pieceView = new ListView("pieceView", >pieces) >{ > /** >* >*/ > private static final long serialVersionUID = > 1569632937178977468L; > > @Override > protected void populateItem(ListItem 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-unsubscr...@wicket.apache.org >For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView
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, JavaTravelerwrote: > 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 pieceView = new ListView("pieceView", pieces) > { > /** > * > */ > private static final long serialVersionUID = > 1569632937178977468L; > > @Override > protected void populateItem(ListItem 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-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > -- WBR Maxim aka solomax - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView Add/Remove via AJAX...
Hi James, Some time ago I wrote this: https://github.com/duesenklipper/wicket-appendablerepeater It should work with forms. If not, let me know. Best regards Carl-Eric On 27.03.2018 14:42, James Carman wrote: It has been a while since I've used Wicket and man, I really forgot how much I love this framework! It may be that I'm rusty, but I've searched quite a bit and tried all the suggestions I've found, but I can't seem to make add/remove via AJAX work for a ListView while preserving the input data. I am using Wicket 8.0.0-M9. Here's what I've done so far: correctChoiceGroup = new CheckGroup<>("correctChoices", Model.ofSet(Sets.newHashSet())); correctChoiceGroup.setRequired(true); correctChoiceGroup.setOutputMarkupId(true); correctChoiceGroup.setRenderBodyOnly(false); final IModelchoicesModel = Model.ofList(new LinkedList<>()); choicesView = new ListView("choices", choicesModel) { @Override protected void populateItem(ListItem item) { final int index = item.getIndex(); item.add(new TextField<>("field", item.getModel())); item.add(new Check<>("check", Model.of(index))); final AjaxSubmitLink deleteLink = new AjaxSubmitLink("deleteButton") { @Override @SuppressWarnings("unchecked") protected void onSubmit(AjaxRequestTarget target) { final ListView listView = findParent(ListView.class); listView.getModelObject().remove(index); listView.removeAll(); target.add(correctChoiceGroup); } }; deleteLink.setDefaultFormProcessing(false); item.add(deleteLink); } }.setReuseItems(true); correctChoiceGroup.add(choicesView); add(new AjaxSubmitLink("addButton") { @Override protected void onSubmit(AjaxRequestTarget target) { choicesView.getModelObject().add(""); choicesView.removeAll(); target.add(correctChoiceGroup); } }.setDefaultFormProcessing(false)); add(correctChoiceGroup); When I click on the delete link (I have a similarly-implemented "add" link outside of the ListView), all of the input data goes away, since I am losing the original items from the removeAll() call. Now, I am doing the removeAll() to force Wicket to realize that I've changed the underlying list, otherwise, the original items are reused and the it always looks like the last item is removed. I'm sure I'm just rusty, but I am banging my head on this one. Thanks, James - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView Add/Remove via AJAX...
Hi James, Welcome back... Still remember you from old times in list :-) On Tue, Mar 27, 2018 at 2:42 PM, James Carmanwrote: > It has been a while since I've used Wicket and man, I really forgot how > much I love this framework! It may be that I'm rusty, but I've searched > quite a bit and tried all the suggestions I've found, but I can't seem to > make add/remove via AJAX work for a ListView while preserving the input > data. I am using Wicket 8.0.0-M9. Here's what I've done so far: > > correctChoiceGroup = new CheckGroup<>("correctChoices", > Model.ofSet(Sets.newHashSet())); > correctChoiceGroup.setRequired(true); > correctChoiceGroup.setOutputMarkupId(true); > correctChoiceGroup.setRenderBodyOnly(false); > > final IModel choicesModel = Model.ofList(new LinkedList<>()); > choicesView = new ListView("choices", choicesModel) { > @Override > protected void populateItem(ListItem item) { > final int index = item.getIndex(); > > item.add(new TextField<>("field", item.getModel())); > item.add(new Check<>("check", Model.of(index))); > > final AjaxSubmitLink deleteLink = new > AjaxSubmitLink("deleteButton") { > @Override > @SuppressWarnings("unchecked") > protected void onSubmit(AjaxRequestTarget target) { > final ListView listView = findParent(ListView.class); > listView.getModelObject().remove(index); > listView.removeAll(); > target.add(correctChoiceGroup); > } > }; > deleteLink.setDefaultFormProcessing(false); > item.add(deleteLink); > } > }.setReuseItems(true); > > > correctChoiceGroup.add(choicesView); > > add(new AjaxSubmitLink("addButton") { > @Override > protected void onSubmit(AjaxRequestTarget target) { > choicesView.getModelObject().add(""); > choicesView.removeAll(); > target.add(correctChoiceGroup); > } > }.setDefaultFormProcessing(false)); > > add(correctChoiceGroup); > > > When I click on the delete link (I have a similarly-implemented "add" link > outside of the ListView), all of the input data goes away, since I am > losing the original items from the removeAll() call. Now, I am doing the > removeAll() to force Wicket to realize that I've changed the underlying > list, otherwise, the original items are reused and the it always looks like > the last item is removed. I'm sure I'm just rusty, but I am banging my > head on this one. > > Thanks, > > James > -- Regards - Ernesto Reinaldo Barreiro
Re: ListView Add/Remove via AJAX...
Hi James, The best explanation for adding items via Ajax you could read at http://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/ Removing an item should be easier if the ListItems have id. On Tue, Mar 27, 2018 at 3:42 PM, James Carmanwrote: > It has been a while since I've used Wicket and man, I really forgot how > much I love this framework! It may be that I'm rusty, but I've searched > quite a bit and tried all the suggestions I've found, but I can't seem to > make add/remove via AJAX work for a ListView while preserving the input > data. I am using Wicket 8.0.0-M9. Here's what I've done so far: > > correctChoiceGroup = new CheckGroup<>("correctChoices", > Model.ofSet(Sets.newHashSet())); > correctChoiceGroup.setRequired(true); > correctChoiceGroup.setOutputMarkupId(true); > correctChoiceGroup.setRenderBodyOnly(false); > > final IModel choicesModel = Model.ofList(new LinkedList<>()); > choicesView = new ListView("choices", choicesModel) { > @Override > protected void populateItem(ListItem item) { > final int index = item.getIndex(); > > item.add(new TextField<>("field", item.getModel())); > item.add(new Check<>("check", Model.of(index))); > > final AjaxSubmitLink deleteLink = new > AjaxSubmitLink("deleteButton") { > @Override > @SuppressWarnings("unchecked") > protected void onSubmit(AjaxRequestTarget target) { > final ListView listView = findParent(ListView.class); > listView.getModelObject().remove(index); > listView.removeAll(); > target.add(correctChoiceGroup); > } > }; > deleteLink.setDefaultFormProcessing(false); > item.add(deleteLink); > } > }.setReuseItems(true); > > > correctChoiceGroup.add(choicesView); > > add(new AjaxSubmitLink("addButton") { > @Override > protected void onSubmit(AjaxRequestTarget target) { > choicesView.getModelObject().add(""); > choicesView.removeAll(); > target.add(correctChoiceGroup); > } > }.setDefaultFormProcessing(false)); > > add(correctChoiceGroup); > > > When I click on the delete link (I have a similarly-implemented "add" link > outside of the ListView), all of the input data goes away, since I am > losing the original items from the removeAll() call. Now, I am doing the > removeAll() to force Wicket to realize that I've changed the underlying > list, otherwise, the original items are reused and the it always looks like > the last item is removed. I'm sure I'm just rusty, but I am banging my > head on this one. > > Thanks, > > James >
Re: ListView color background lineitem dinamically not working
Thank you, it's great! On Thu, Mar 16, 2017 at 1:05 PM, Sven Meierwrote: > Hi, > > you'll have to add two MarkupContainers and style both : > > > > ... > ... > > > protected void populateItem(ListItem item) { > WebMarkupContainer firstRow = new WebMarkupContainer("firstRow") { > @Override > protected void onComponentTag(final ComponentTag tag) { > Items line = item.getModelObject(); > if (line.getIdLn() == 6) > tag.put("style", "background-color:green"); > else if (line.getIdLn() == 4 ) > tag.put("style", "background-color:red"); > > // continue with default behavior > super.onComponentTag(tag); > }; > item.add(firstRow); > > firstRow.add(... > > WebMarkupContainer secondRow = ...; > } > > Best regards > Sven > > > On 16.03.2017 11:39, ganea iulia wrote: > >> Thank you so much for you explanation. >> I had to put the two inside the because I need to >> repeat every two rows. >> Do you have any hint on how to do it and still be able to change the >> color? >> >> >> >> On Thu, Mar 16, 2017 at 12:36 PM, ganea iulia >> wrote: >> >> Thank you so much for you explanation. >>> I had to put the two inside the because I need to >>> repeat every two rows. >>> >>> >>> >>> On Thu, Mar 16, 2017 at 11:26 AM, Sven Meier wrote: >>> >>> Hi, it seems your ListView is bound to the >>> wicket:id="forEachItem"> tag, which cannot be styled. Change your markup to: Have fun Sven On 16.03.2017 09:58, ganea iulia wrote: Hello, > > I have a listview and I want to dinamically color some of the rows > (items). > But it is not working, nothing gets colored when it should. > > *Here is the markup:* > > > > > [item1] > [item2] > [item3] > [item4] > [item5] > [item6] > [item7] > [item8] > [item9] > [item10] > > > cols="100">Area > > > > > > *Here is the code:* > > @Override > protected ListItem newItem(final int index, IModel > model) { > return new ListItem(index, getListItemModel(getModel(), index)) > { > > @Override > protected void onComponentTag(final ComponentTag tag) { > Items line = getModelObject(); > if (line.getIdLn() == 6) > tag.put("style", "background-color:green"); > else if (line.getIdLn() == 4 ) > tag.put("style", "background-color:red"); > > // continue with default behavior > super.onComponentTag(tag); > > } > }; > } > > Could you please advise? > > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: ListView color background lineitem dinamically not working
Hi, you'll have to add two MarkupContainers and style both : ... ... protected void populateItem(ListItem item) { WebMarkupContainer firstRow = new WebMarkupContainer("firstRow") { @Override protected void onComponentTag(final ComponentTag tag) { Items line = item.getModelObject(); if (line.getIdLn() == 6) tag.put("style", "background-color:green"); else if (line.getIdLn() == 4 ) tag.put("style", "background-color:red"); // continue with default behavior super.onComponentTag(tag); }; item.add(firstRow); firstRow.add(... WebMarkupContainer secondRow = ...; } Best regards Sven On 16.03.2017 11:39, ganea iulia wrote: Thank you so much for you explanation. I had to put the two inside the because I need to repeat every two rows. Do you have any hint on how to do it and still be able to change the color? On Thu, Mar 16, 2017 at 12:36 PM, ganea iuliawrote: Thank you so much for you explanation. I had to put the two inside the because I need to repeat every two rows. On Thu, Mar 16, 2017 at 11:26 AM, Sven Meier wrote: Hi, it seems your ListView is bound to the tag, which cannot be styled. Change your markup to: Have fun Sven On 16.03.2017 09:58, ganea iulia wrote: Hello, I have a listview and I want to dinamically color some of the rows (items). But it is not working, nothing gets colored when it should. *Here is the markup:* [item1] [item2] [item3] [item4] [item5] [item6] [item7] [item8] [item9] [item10] Area *Here is the code:* @Override protected ListItem newItem(final int index, IModel model) { return new ListItem(index, getListItemModel(getModel(), index)) { @Override protected void onComponentTag(final ComponentTag tag) { Items line = getModelObject(); if (line.getIdLn() == 6) tag.put("style", "background-color:green"); else if (line.getIdLn() == 4 ) tag.put("style", "background-color:red"); // continue with default behavior super.onComponentTag(tag); } }; } Could you please advise? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView color background lineitem dinamically not working
Thank you so much for you explanation. I had to put the two inside the because I need to repeat every two rows. Do you have any hint on how to do it and still be able to change the color? On Thu, Mar 16, 2017 at 12:36 PM, ganea iuliawrote: > Thank you so much for you explanation. > I had to put the two inside the because I need to > repeat every two rows. > > > > On Thu, Mar 16, 2017 at 11:26 AM, Sven Meier wrote: > >> Hi, >> >> it seems your ListView is bound to the > wicket:id="forEachItem"> tag, which cannot be styled. >> >> Change your markup to: >> >> >> >> >> Have fun >> Sven >> >> >> On 16.03.2017 09:58, ganea iulia wrote: >> >>> Hello, >>> >>> I have a listview and I want to dinamically color some of the rows >>> (items). >>> But it is not working, nothing gets colored when it should. >>> >>> *Here is the markup:* >>> >>> >>> >>> >>> [item1] >>> [item2] >>> [item3] >>> [item4] >>> [item5] >>> [item6] >>> [item7] >>> [item8] >>> [item9] >>> [item10] >>> >>> >>> >> cols="100">Area >>> >>> >>> >>> >>> >>> *Here is the code:* >>> >>> @Override >>> protected ListItem newItem(final int index, IModel model) { >>> return new ListItem(index, getListItemModel(getModel(), index)) { >>> >>> @Override >>> protected void onComponentTag(final ComponentTag tag) { >>> Items line = getModelObject(); >>> if (line.getIdLn() == 6) >>> tag.put("style", "background-color:green"); >>> else if (line.getIdLn() == 4 ) >>> tag.put("style", "background-color:red"); >>> >>> // continue with default behavior >>> super.onComponentTag(tag); >>> >>> } >>> }; >>> } >>> >>> Could you please advise? >>> >>> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> >
Re: ListView color background lineitem dinamically not working
Thank you so much for you explanation. I had to put the two inside the because I need to repeat every two rows. On Thu, Mar 16, 2017 at 11:26 AM, Sven Meierwrote: > Hi, > > it seems your ListView is bound to the wicket:id="forEachItem"> tag, which cannot be styled. > > Change your markup to: > > > > > Have fun > Sven > > > On 16.03.2017 09:58, ganea iulia wrote: > >> Hello, >> >> I have a listview and I want to dinamically color some of the rows >> (items). >> But it is not working, nothing gets colored when it should. >> >> *Here is the markup:* >> >> >> >> >> [item1] >> [item2] >> [item3] >> [item4] >> [item5] >> [item6] >> [item7] >> [item8] >> [item9] >> [item10] >> >> >> > cols="100">Area >> >> >> >> >> >> *Here is the code:* >> >> @Override >> protected ListItem newItem(final int index, IModel model) { >> return new ListItem(index, getListItemModel(getModel(), index)) { >> >> @Override >> protected void onComponentTag(final ComponentTag tag) { >> Items line = getModelObject(); >> if (line.getIdLn() == 6) >> tag.put("style", "background-color:green"); >> else if (line.getIdLn() == 4 ) >> tag.put("style", "background-color:red"); >> >> // continue with default behavior >> super.onComponentTag(tag); >> >> } >> }; >> } >> >> Could you please advise? >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: ListView color background lineitem dinamically not working
Hi, it seems your ListView is bound to the wicket:id="forEachItem"> tag, which cannot be styled. Change your markup to: Have fun Sven On 16.03.2017 09:58, ganea iulia wrote: Hello, I have a listview and I want to dinamically color some of the rows (items). But it is not working, nothing gets colored when it should. *Here is the markup:* [item1] [item2] [item3] [item4] [item5] [item6] [item7] [item8] [item9] [item10] Area *Here is the code:* @Override protected ListItem newItem(final int index, IModel model) { return new ListItem(index, getListItemModel(getModel(), index)) { @Override protected void onComponentTag(final ComponentTag tag) { Items line = getModelObject(); if (line.getIdLn() == 6) tag.put("style", "background-color:green"); else if (line.getIdLn() == 4 ) tag.put("style", "background-color:red"); // continue with default behavior super.onComponentTag(tag); } }; } Could you please advise? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView color background lineitem dinamically not working
Hi, The problem is at: You need the to be Wicket component. is not rendered at Production mode. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Mar 16, 2017 at 9:58 AM, ganea iuliawrote: > Hello, > > I have a listview and I want to dinamically color some of the rows (items). > But it is not working, nothing gets colored when it should. > > *Here is the markup:* > > > > > [item1] > [item2] > [item3] > [item4] > [item5] > [item6] > [item7] > [item8] > [item9] > [item10] > > > cols="100">Area > > > > > > *Here is the code:* > > @Override > protected ListItem newItem(final int index, IModel model) { > return new ListItem(index, getListItemModel(getModel(), index)) { > > @Override > protected void onComponentTag(final ComponentTag tag) { > Items line = getModelObject(); > if (line.getIdLn() == 6) > tag.put("style", "background-color:green"); > else if (line.getIdLn() == 4 ) > tag.put("style", "background-color:red"); > > // continue with default behavior > super.onComponentTag(tag); > > } > }; > } > > Could you please advise? >
Re: ListView vs. RefreshingView and the meaning of the word 'refreshing'
Hi, yes, ListView and RefreshingView are quite similar. ListView is a repeater implementation from Wicket's very early days: it works on a list of objects - wrapped in a model of course, as you'd expect it from a proper Wicket component. RefreshingView doesn't care where the objects to iterate over come from: getItemModels() provides a list of models of objects, something you can get from a dataProvider. "Refreshing" is related to "create a fresh component" for each new model, i.e. a model for which a component hasn't been created before. Have fun Sven On 08.08.2016 12:08, Davids Patrick wrote: Hi all, a question, I have in mind since about 3 years but I never asked... ;-) Don't know why, now, I do... ListViews and RefreshingViews are very similar. Especially due to the default flag setReuseItems false of ListView, they both behave "refreshing" to me. (populating items is called each request) So, now my question(s)... Does the word "Refreshing" is more related to the method getItemModels(...) of RefreshingView? Does it mean, fetching a "fresh" new model implementation of the particular item? Or does it mean fetching a "fresh" new component instance of the particular item? Or does it mean always reading "fresh" data of some "dataprovider"/listmodel? best regards Patrick Health AG | Patrick Davids | Softwareentwickler Tel. +49 40 524 709-258 | p.dav...@healthag.de Fax +49 40 524 709-258 | www.healthag.de EOS Health Honorarmanagement AG | Lübeckertordamm 1–3 | 20099 Hamburg | AG Hamburg HRB 93806 Vorstand | Jens Törper, Uwe Schäfer Aufsichtsratsvorsitzender | Klaus Engberding Save a tree – think before you print. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: listview with check box does not update model when checked
Hi, sorry but I don't understand your problem. You'll have to simplify your code, or it will be difficult to give you any advice. Creating a quickstart would be a good way to show what you want to achieve. Regards Sven -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/listview-with-check-box-does-not-update-model-when-checked-tp4674950p4674951.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView - onComponentTag
Hi, ListView uses its markup tag to render each of its items and is not visible in the output by itself - thus it doesn't contribute anything to the component tag. Sven On 03/10/2014 07:19 PM, Nick Pratt wrote: Is there any reason why onComponentTag() wouldn't be invoked on a ListView: ListViewUser users = new ListViewUser( team-members, usersModel ) { @Override protected void onComponentTag( ComponentTag tag ) { super.onComponentTag( tag ); int i = 0; } ... I set a breakpoint on 'int i =0'; but its never hit - either on initial page render or when the containing Panel is refreshed via Ajax. None of the child behaviors attached to the ListView are triggered either (no onComponentTag execution) Wicket 6.14.0 N - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView remove a row by SubmitLink always move the last one
Sven, I forgot. code: - ListView listView = new ListView( users, users ) { @Override protected void populateItem( final ListItem item ) { item.setDefaultModel( new CompoundPropertyModel( item.getModelObject() ) ); item.add( new TextFieldString( firstName ) ); item.add( new TextFieldString( lastName ) ); item.add( //removeLink( remove, item ) ); new SubmitLink( remove, item.getModel() ) { private static final long serialVersionUID = 1L; @Override public void onSubmit() { // copy from ListView removeLink addStateChange(); item.modelChanging(); getList().remove( item.getIndex() ); modelChanged(); removeAll(); } }.setDefaultFormProcessing( false ) ); } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-delete-the-last-one-tp4659796p4659895.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView remove a row by SubmitLink always move the last one
First of all don't pull something out of a model and put it into another model: item.setDefaultModel(new CompoundPropertyModel( item.getModelObject() ) ); Do this instead: item.setDefaultModel(new CompoundPropertyModel( item.getModel() ) ); Perhaps this is the reason: the textfields are showing stale data. Sven On 06/28/2013 11:20 AM, always_rick wrote: Sven, I forgot. code: - ListView listView = new ListView( users, users ) { @Override protected void populateItem( final ListItem item ) { item.setDefaultModel( new CompoundPropertyModel( item.getModelObject() ) ); item.add( new TextFieldString( firstName ) ); item.add( new TextFieldString( lastName ) ); item.add( //removeLink( remove, item ) ); new SubmitLink( remove, item.getModel() ) { private static final long serialVersionUID = 1L; @Override public void onSubmit() { // copy from ListView removeLink addStateChange(); item.modelChanging(); getList().remove( item.getIndex() ); modelChanged(); removeAll(); } }.setDefaultFormProcessing( false ) ); } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-delete-the-last-one-tp4659796p4659895.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView remove a row by SubmitLink always move the last one
Thank you for quick response. I tried what you suggested, no luck. What I think is clicking remove link (SubmitLink), form memorizes input data, then remove row. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-delete-the-last-one-tp4659796p4659899.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView remove a row by SubmitLink always move the last one
Sorry, I'm out of ideas. If you can create a quickstart, I'll debug the problem. Sven On 06/28/2013 12:43 PM, always_rick wrote: Thank you for quick response. I tried what you suggested, no luck. What I think is clicking remove link (SubmitLink), form memorizes input data, then remove row. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-delete-the-last-one-tp4659796p4659899.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView remove a row by SubmitLink always move the last one
ListPage.html http://apache-wicket.1842946.n4.nabble.com/file/n4659905/ListPage.html ListPage.java http://apache-wicket.1842946.n4.nabble.com/file/n4659905/ListPage.java User.java http://apache-wicket.1842946.n4.nabble.com/file/n4659905/User.java Hi Sven, it is odd. When I was building the quickstart, SubmitLink acts like removeLink. It was directly copied for the code. I am going to review my code on weekend. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-delete-the-last-one-tp4659796p4659905.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView remove a row by SubmitLink always move the last one
Hi Sven, I review my code and api. I misunderstood the setDefaultFormProcessing( false ). Simply removing that method, then it works. Now I am thinking of a way to skip validation, and process form updating. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-delete-the-last-one-tp4659796p4659919.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView remove a row by SubmitLink always move the last one
You'll have to show us some code. Sven On 06/26/2013 08:33 AM, always_rick wrote: Hi all, I have a form of inputs (ListView). I firstly tried the removeLink, it was working. Because it is a normal link, it simply don't keep the other rows inputs. Obviously, it does not meet the requirement. I thought SubmitLink was good, but it always removed the last row. I clearly see the index is correct, but result is incorrect. I searched this forum and google, and found the a few answers, none of them worked in my case. Could some one please help? p.s. I set setReuseItems(true) 'coz wicket api said, If you nest a ListView in a Form, always set this property to true, as otherwise validation will not work properly., which is correct. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-move-the-last-one-tp4659796.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView does not repaint inside WebMarcupContainer using AjaxLink
ajax repainting will not work with wicket:container or setrenderbodyonly(true) as in that case component tag is not rendered in html.another way is repainting grand(er) parent which doesn't have setrenderbodyonly(true) or wicket:container On Sun, Mar 17, 2013 at 3:22 PM, meduolis meduol...@gmail.com wrote: Hi, does anybody knows how to repaint ListView properly using AjaxLink? This https://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html https://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html does not work for me. If I use Link, everything works. But not with AjaxLink. Help, please === Markup: === Java: === -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-does-not-repaint-inside-WebMarcupContainer-using-AjaxLink-tp4657300.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- regards, Vineet Semwal
Re: Listview Checkbox checked by default and disapearing after submit
Thank you so much, I would never have found that! Everything works perfectly now cheers -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Listview-Checkbox-checked-by-default-and-disapearing-after-submit-tp4654605p4654610.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview Checkbox checked by default and disapearing after submit
this.checkGroup = new CheckGroup(checkgroup, new CompoundPropertyModel(this.someList)); ... this.listView = new ListViewString[](someList, new CompoundPropertyModel(this.someList)) Do you really want the list to iterate over the checked items only? I'd expect these components to use different lists: one for all selected and one for all available Sven On 12/07/2012 08:04 PM, Pat wrote: Hi, I have searched for this problem and read many entries but I can't seem to figure it out. I have two problems: 1. When instantiate my ListView with Check checkboxes they are always checked by default. I can't manage to uncheck them by default. 2. Once I have chosen items from my list via the checkboxes and submitted the form depending on how many checkboxes have been checked, that amount of rows just disappears from the bottom of my list. It doesn't matter which boxes I check, it's always the rows from the bottom up that disappear. It would be really great if anyone could help, thanks you in advance. Here is my code: // initialize CheckGroup this.checkGroup = new CheckGroup(checkgroup, new CompoundPropertyModel(this.someList)); someForm.add(checkGroup); // initialize ListView this.listView = new ListViewString[](someList, new CompoundPropertyModel(this.someList)) { @Override protected void populateItem(ListItem item) { String[] array = (String[]) item.getModelObject(); item.add(new Check(checkbox, item.getModel())); item.add(new Label(label1, array[0])); item.add(new Label(label2, array[1])); item.add(new Label(label3, array[2])); } }; this.listView.setReuseItems(true); checkGroup.add(this.listView); protected void onSubmit() { LinkedListString[] list = ((LinkedListString[])checkGroup.getModelObject()); for(int i=0; ilist.size(); i++) { //do stuff with the list } }; -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Listview-Checkbox-checked-by-default-and-disapearing-after-submit-tp4654605.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview containing links not working, when created through AJAX update
Hi, On Tue, Oct 9, 2012 at 4:26 PM, Anders Sørensen aisz...@gmail.com wrote: I have an application which worked in Wicket 1.5.x, but something seems to be broken, after updating to 6.1.1. I have a table listing machines on the left side. When an item is clicked, I update a table on the right using AJAX. This updated table contains a lot of AjaxLinks, but none of the them works. Clicking them triggers nothing. Nothing happens in my Firebug console. Looking at the ajax-response in Firebug, I see no header-contribution element in the response. I would expect, to see lines like this, in the header-contribution of the ajax-response, but nothing: Wicket.Ajax.ajax({u:./?3-4.IBehaviorListener.0-tabs-panel-list-computerli st.table-computerlist.table_body-computerlist.table.row-0-computerlist.table .row.link,e:click,c:idcd1});; Those should be in evaluate tags in the Ajax response, not in header-contirbution which is used to load more .js/.css resources. Is this a bug, or have I missed something while upgrading from 1.5. til 6.1.1? If you can reproduce it in a quickstart then please attach it to a ticket in Jira. Best regards Ais -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView (or other Repeater) with backing map
On Mon, 30 Apr 2012 10:25:21 -0700 (PDT) cmagnollay cmagnol...@gmail.com wrote: So essentially I want to use Wicket 1.5 to display an item and its associated quantity. The data structure I am using to back this is a Map (new HashMap()) where Item is a POJ whose details are of no consequence. Essentially I would like to use one of wicket's repeaters, but I only have experience using ListView. Is there a repeater that would work well with a Map, or am I going to need to code my own? If I need to code my own, what is the best class to override? The List has has key-value pairs of type: Item-Integer where integer is the quantity. I'd just use Map#entrySet, which gives you a SetMap.EntryItem,Integer. You can turn that into a list and feed it to a ListViewMap.EntryItem,Integer. That way you have an Entry in each ListItem and can simply use its two parts. Hope this helps. Carl-Eric - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView (or other Repeater) with backing map
if the map is called something like MapItem, Integer itemMap = new HashMapItem, Integer(); Hmm, so I would instantiate the ListView like so? ListViewListlt;Map.Entrylt;Item, Integer lv = new ListViewListlt;Map.Entrylt;Item, Integer(id, new PropertyModelListlt;Map.Entrylt;Item, Integer(this, itemMap.entrySet()){ populateItem(Map.EntryItem, Integer entry) { } } Is this what you are implying somewhat? Thanks for the answer by the way, I had not considered just, for lack of a better term, fooling the listview into using my map elements. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-or-other-Repeater-with-backing-map-tp4598817p4598865.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView (or other Repeater) with backing map
On Mon, 30 Apr 2012 10:43:30 -0700 (PDT) cmagnollay cmagnol...@gmail.com wrote: if the map is called something like MapItem, Integer itemMap = new HashMapItem, Integer(); Hmm, so I would instantiate the ListView like so? [...] Is this what you are implying somewhat? Thanks for the answer by the way, I had not considered just, for lack of a better term, fooling the listview into using my map elements. Basically yes, though the propertymodel won't work like that. I'd do something like this (pseudocode): MapItem,Integer itemMap = ...; IModelListMap.EntryItem,Integer mapListModel = new LoadableDetachableModel() { load() { return new ArrayList...(itemMap.entrySet()); } }; ...new ListViewMap.Entry...(id, mapListModel) { populateItem(ListItemItem,Integer li) { ... } } Carl-Eric - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView (or other Repeater) with backing map
And I can force the model to update, via AJAX, or in other words, how I force the list view to update after a user action? onUpdate(AjaxRequestTarget target) { target.add(theListView) ?? } or is it something I do with the model itself? Sorry, I have no experience with LoadableDetachable, and a quick glance at the API did not enlighten me. My guess would be to give the listview a new model on each trigger of the AJAX code. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-or-other-Repeater-with-backing-map-tp4598817p4599009.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView (or other Repeater) with backing map
You can call LDM#detach() after the modification, but since this particular implementation is so light, I'd just use AbstractReadyOnlyModel instead. It doesn't cache, so detach is not required. On Mon, Apr 30, 2012 at 11:36 AM, cmagnollay cmagnol...@gmail.com wrote: And I can force the model to update, via AJAX, or in other words, how I force the list view to update after a user action? onUpdate(AjaxRequestTarget target) { target.add(theListView) ?? } or is it something I do with the model itself? Sorry, I have no experience with LoadableDetachable, and a quick glance at the API did not enlighten me. My guess would be to give the listview a new model on each trigger of the AJAX code. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-or-other-Repeater-with-backing-map-tp4598817p4599009.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView (or other Repeater) with backing map
On Mon, 30 Apr 2012 11:38:36 -0700 Dan Retzlaff dretzl...@gmail.com wrote: You can call LDM#detach() after the modification, but since this particular implementation is so light, I'd just use AbstractReadyOnlyModel instead. It doesn't cache, so detach is not required. Actually, getObject() can be called pretty often, so that would incur the cost of creating the new List object *each time*. I would really use the LDM. Since in my example the LDM is passed directly into the ListView as its default model, the ListView will take care of detaching [1]. cmagnollay, that means that on each render you should simply see whatever is currently in your map, so it should be up to date on its own without further action. An LDM calls the load() method the first time its getObject() is called. The value you return from load() will be cached until detach() is called on the LDM. The normal usecase is to do an expensive operation (load from DB, create a lot of objects, etc) only once in a request but to still have fresh data in each request. Also it reduces session size because the cached data is not kept between requests. Hope this helps! Carl-Eric [1] Carl-Eric's rule of detaching models: *always* do one of the following: - detach the model yourself - pass the model to one of your child components or your superclass, thus making it that code's responsibility. You never know what model implementation you might be getting as a parameter. Be nice to whoever calls you. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView (or other Repeater) with backing map
I assumed the action phase would dereference the ListItemModel (e.g. to remove it from the map), hence dereference the LDM, and then require the explicit detach() before rendering. Agreed that LDM is the way to go if you're concerned about the ArrayList constructions. On Mon, Apr 30, 2012 at 11:57 AM, Carl-Eric Menzel cmen...@wicketbuch.dewrote: On Mon, 30 Apr 2012 11:38:36 -0700 Dan Retzlaff dretzl...@gmail.com wrote: You can call LDM#detach() after the modification, but since this particular implementation is so light, I'd just use AbstractReadyOnlyModel instead. It doesn't cache, so detach is not required. Actually, getObject() can be called pretty often, so that would incur the cost of creating the new List object *each time*. I would really use the LDM. Since in my example the LDM is passed directly into the ListView as its default model, the ListView will take care of detaching [1]. cmagnollay, that means that on each render you should simply see whatever is currently in your map, so it should be up to date on its own without further action. An LDM calls the load() method the first time its getObject() is called. The value you return from load() will be cached until detach() is called on the LDM. The normal usecase is to do an expensive operation (load from DB, create a lot of objects, etc) only once in a request but to still have fresh data in each request. Also it reduces session size because the cached data is not kept between requests. Hope this helps! Carl-Eric [1] Carl-Eric's rule of detaching models: *always* do one of the following: - detach the model yourself - pass the model to one of your child components or your superclass, thus making it that code's responsibility. You never know what model implementation you might be getting as a parameter. Be nice to whoever calls you. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView (or other Repeater) with backing map
Thank for you all for the response. I am trying to test that code but am having a different separate issue at the moment. Your solutions however worked exactly as intended. Thank you for all the help! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-or-other-Repeater-with-backing-map-tp4598817p4599149.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView (or other Repeater) with backing map
On Mon, 30 Apr 2012 12:15:20 -0700 Dan Retzlaff dretzl...@gmail.com wrote: I assumed the action phase would dereference the ListItemModel (e.g. to remove it from the map), hence dereference the LDM, and then require the explicit detach() before rendering. Agreed that LDM is the way to go if you're concerned about the ArrayList constructions. That assumption depends very much on the code you give the model to. Many places will simply call getObject() instead of keeping a reference to whatever is inside. PropertyModel is one of them that is very commonly used. Carl-Eric - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView not refreshed after a new row is inserted with EJB3 as its backend data
Use a LoadableDetachableModelListUser in the ListView Constructor. Put all the load loading into the load method and see what happens. Cheers Per Am 19.01.2012 07:49, schrieb x.yang: Hello, Everyone, I am trying to build a web app with Wicket, EJB3, and MySQL. My IDE is Netbeans 6.9.1 and the server is Glassfish 3.1. I have created two entity beans 'Centre' and 'User', and one Centre has many User(s). I also created two Facades for them. The Wicket page used to list the Users is as below: class ListUsers extends WebPage { @EJB(name = UserFacade) private UserFacade userFacade; public ListUsers(Centre c) { ListUser users; if (c == null) { users = userFacade.findAll(); } else { users = new ArrayListUser(c.getUserCollection()); } final ListViewUser list = new ListViewUser(eachUser, users) { @Override protected void populateItem(ListItem item) { final User user = (User) item.getModelObject(); item.add(new Label(username, user.getUsername())); item.add(new Label(fullname, user.getFullname())); item.add(new Label(email, user.getEmail())); item.add(new Label(centreid, user.getCentre().getName())); } }; add(list); } } - The page to add a User is following: public AddUser(Centre c) { user = new User(); user.setCentre(c); FormAddUser form = new FormAddUser(AddUser) { @Override protected void onSubmit() { userFacade.create(user); } }; form.add(new TextFieldString(username, new PropertyModel(user, username)).setRequired(true)); PasswordTextField tf_password = new PasswordTextField(password, new PropertyModel(user, hashedPassword)); form.add(tf_password); form.add(new TextFieldString(fullname, new PropertyModel(user, fullname)).setRequired(true)); TextField tf_email = new TextFieldString(email, new PropertyModel(user, email)); form.add(tf_email); LoadableDetachableModel centres = new LoadableDetachableModel() { @Override protected Object load() { return centreFacade.findAll(); } }; DropDownChoiceCentre ddc = new DropDownChoiceCentre(centreid, new PropertyModelCentre(user, centre), centres, new ChoiceRendererCentre(name, name)); form.add(ddc.setRequired(true)); add(form); } } The problem is I can't see the newly added User in the list with getUserCollection() method of Centre, but I do see the new User if I use userFacade.findAll() method. Could you please help me and point me to the right direction? I am quite new to Wicket and EJB3. Any comments are welcom. Thanks a lot. Yang -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-not-refreshed-after-a-new-row-is-inserted-with-EJB3-as-its-backend-data-tp4309318p4309318.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView inside a ListView
add(new ListViewAllocation(allocation, allocationListModel) { shouldn't this be item.add ? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView inside a ListView
For clarity, I would rename the ListItems: protected void populateItem(final ListItemAsset assetItem) { assetItem.add(new Label(...)); assetItem.add(new ListViewAllocation(...) { protected void populateItem(ListItemAllocation allocationItem) { allocationItem.add(new Label(...)); } } } On Wed, May 25, 2011 at 10:39 AM, Peter Karich peat...@yahoo.de wrote: add(new ListViewAllocation(allocation, allocationListModel) { shouldn't this be item.add ? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView inside a ListView
Thank you so much!!! It worked Silly mistakes cost a lot!!! Thanks again!! On Wed, May 25, 2011 at 1:40 PM, Peter Karich [via Apache Wicket] ml-node+3550472-1465528180-240...@n4.nabble.com wrote: add(new ListViewAllocation(allocation, allocationListModel) { shouldn't this be item.add ? - To unsubscribe, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=3550472i=0 For additional commands, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=3550472i=1 -- If you reply to this email, your message will be added to the discussion below: http://apache-wicket.1842946.n4.nabble.com/ListView-inside-a-ListView-tp3550315p3550472.html To unsubscribe from ListView inside a ListView, click herehttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=3550315code=cy52ZW5rYXRhNDEwQGdtYWlsLmNvbXwzNTUwMzE1fDEzMDcyMDgwMzE=. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-inside-a-ListView-tp3550315p3550495.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView inside a ListView
Will do that now!! Got it worked!!! Thanks a lot!!! On Wed, May 25, 2011 at 1:47 PM, scott.swank [via Apache Wicket] ml-node+3550491-1122803921-240...@n4.nabble.com wrote: For clarity, I would rename the ListItems: protected void populateItem(final ListItemAsset assetItem) { assetItem.add(new Label(...)); assetItem.add(new ListViewAllocation(...) { protected void populateItem(ListItemAllocation allocationItem) { allocationItem.add(new Label(...)); } } } On Wed, May 25, 2011 at 10:39 AM, Peter Karich [hidden email]http://user/SendEmail.jtp?type=nodenode=3550491i=0 wrote: add(new ListViewAllocation(allocation, allocationListModel) { shouldn't this be item.add ? - To unsubscribe, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=3550491i=1 For additional commands, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=3550491i=2 - To unsubscribe, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=3550491i=3 For additional commands, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=3550491i=4 -- If you reply to this email, your message will be added to the discussion below: http://apache-wicket.1842946.n4.nabble.com/ListView-inside-a-ListView-tp3550315p3550491.html To unsubscribe from ListView inside a ListView, click herehttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=3550315code=cy52ZW5rYXRhNDEwQGdtYWlsLmNvbXwzNTUwMzE1fDEzMDcyMDgwMzE=. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-inside-a-ListView-tp3550315p3550497.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview gives mysterious log info
Sounds like you are calling setOutputMarkupId on a container. So I googled your error message and founr WICKET-3237 (https://issues.apache.org/jira/browse/WICKET-3237) Bas Op 30-3-2011 8:54, nino martinez wael schreef: Listview gives mysterious log info what does it mean? This feels a bit like deja vu but I could'nt find my post so forgive me i am double posting .. 2011-03-29 15:27:32,316 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule23, component id: triggerSchedule, component tag: container. 2011-03-29 15:27:32,348 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule26, component id: triggerSchedule, component tag: container. 2011-03-29 15:27:32,363 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule29, component id: triggerSchedule, component tag: container. 2011-03-29 15:27:32,379 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule2c, component id: triggerSchedule, component tag: container. 2011-03-29 15:27:32,410 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule2f, component id: triggerSchedule, component tag: container. 2011-03-29 15:27:32,410 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule32, component id: triggerSchedule, component tag: container. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview gives mysterious log info
Ahh yes, I was diving a bit too deep in my ajax, to notice the html side:) Nice that wicket is that way, I mean that you actually can forget about js/html when doing ajax :) 2011/3/30 Bas Gooren b...@iswd.nl: Sounds like you are calling setOutputMarkupId on a container. So I googled your error message and founr WICKET-3237 (https://issues.apache.org/jira/browse/WICKET-3237) Bas Op 30-3-2011 8:54, nino martinez wael schreef: Listview gives mysterious log info what does it mean? This feels a bit like deja vu but I could'nt find my post so forgive me i am double posting .. 2011-03-29 15:27:32,316 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule23, component id: triggerSchedule, component tag: container. 2011-03-29 15:27:32,348 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule26, component id: triggerSchedule, component tag: container. 2011-03-29 15:27:32,363 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule29, component id: triggerSchedule, component tag: container. 2011-03-29 15:27:32,379 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule2c, component id: triggerSchedule, component tag: container. 2011-03-29 15:27:32,410 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule2f, component id: triggerSchedule, component tag: container. 2011-03-29 15:27:32,410 WARN [org.apache.wicket.Component] - Markup id set on a component that is usually not rendered into markup. Markup id: triggerSchedule32, component id: triggerSchedule, component tag: container. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView magic
You can set row hidden if you want, no problem: ajaxRequestTarget.addComponent(listItem.setVisible(false)); ** Martin 2010/11/14 meduolis meduol...@gmail.com: Hello, I want to do with listview some things, like after removing one item, don't repaint other items. Or maby this component is not right for such a magic? What can I use instead of listview? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-magic-tp3041784p3041784.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview remove columns on the fly
Re-render it before going to excel.. 2010/8/31 Altuğ Bilgin Altıntaş alt...@gmail.com: Hi all; How can i disable Listview's column/s while post it to excel on the fly. I mean i don't want to post all columns into excel. Link linkExcel = new Link(linkExcel) { private static final long serialVersionUID = 1L; �...@override public void onClick() { getRequestCycle().setRequestTarget( new ComponentRequestTarget(tableContainer) { �...@override public void respond(RequestCycle requestCycle) { final int oldipp = supplierListView.getRowsPerPage(); supplierListView.setRowsPerPage(Integer.MAX_VALUE); supplierListView.setMetaData(); *// I don't want to post all listview's columns into excel * super.respond(requestCycle); supplierListView.setRowsPerPage(oldipp); } }); WebResponse wr = (WebResponse) getResponse(); wr.setContentType(application/vnd.ms-excel; charset=UTF-8); wr.setCharacterEncoding(UTF-8); wr.setHeader(content-disposition, attachment;filename=excel.xls); } }; Thanks.
Re: Listview remove columns on the fly
Any code example ? Thanks. 2010/8/31 Martin Makundi martin.maku...@koodaripalvelut.com Re-render it before going to excel.. 2010/8/31 Altuğ Bilgin Altıntaş alt...@gmail.com: Hi all; How can i disable Listview's column/s while post it to excel on the fly. I mean i don't want to post all columns into excel. Link linkExcel = new Link(linkExcel) { private static final long serialVersionUID = 1L; @Override public void onClick() { getRequestCycle().setRequestTarget( new ComponentRequestTarget(tableContainer) { @Override public void respond(RequestCycle requestCycle) { final int oldipp = supplierListView.getRowsPerPage(); supplierListView.setRowsPerPage(Integer.MAX_VALUE); supplierListView.setMetaData(); *// I don't want to post all listview's columns into excel * super.respond(requestCycle); supplierListView.setRowsPerPage(oldipp); } }); WebResponse wr = (WebResponse) getResponse(); wr.setContentType(application/vnd.ms-excel; charset=UTF-8); wr.setCharacterEncoding(UTF-8); wr.setHeader(content-disposition, attachment;filename=excel.xls); } }; Thanks.
Re: Listview remove columns on the fly
Any button will re-render the page. Just make your column in visible: listview() { onpopulate (item) { item.add(column.setVisible(if-you-want-to-show-it-now)); } } form.add(listview); button=new button() { onsubmit() { if-you-want-to-show-it-now = false; } } form.add(button); 2010/8/31 Altuğ Bilgin Altıntaş alt...@gmail.com: Any code example ? Thanks. 2010/8/31 Martin Makundi martin.maku...@koodaripalvelut.com Re-render it before going to excel.. 2010/8/31 Altuğ Bilgin Altıntaş alt...@gmail.com: Hi all; How can i disable Listview's column/s while post it to excel on the fly. I mean i don't want to post all columns into excel. Link linkExcel = new Link(linkExcel) { private static final long serialVersionUID = 1L; �...@override public void onClick() { getRequestCycle().setRequestTarget( new ComponentRequestTarget(tableContainer) { �...@override public void respond(RequestCycle requestCycle) { final int oldipp = supplierListView.getRowsPerPage(); supplierListView.setRowsPerPage(Integer.MAX_VALUE); supplierListView.setMetaData(); *// I don't want to post all listview's columns into excel * super.respond(requestCycle); supplierListView.setRowsPerPage(oldipp); } }); WebResponse wr = (WebResponse) getResponse(); wr.setContentType(application/vnd.ms-excel; charset=UTF-8); wr.setCharacterEncoding(UTF-8); wr.setHeader(content-disposition, attachment;filename=excel.xls); } }; Thanks.
Re: [BULK] Re: Listview remove columns on the fly
If you want to modify your data on a column-base, you should consider using a DataTable instead of DataView/ListView. So long, Benedikt Save Paper: Think Before You Print Beta Systems Email Disclaimer and Email Impressum Beta Systems email messages are confidential. They may also be privileged or otherwise protected by work product immunity orother legal rules. If you have received an email by mistake please let us know by reply and then delete it from your system; you should not copy it or disclose its contents to anyone. All messages sent to and from Beta Systems may be monitored to ensure compliance with internal policies and to protect our business. Emails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, lost or destroyed, or contain viruses. Anyone who communicates with us by email is taken to accept these risks.Beta Systems Email-Sicherheitsinformation Die Inhalte der Emails von Beta Systems sind vertraulich. Sie unterliegen darüber hinaus ggf. dem Schutz von Arbeitsergebnissen oder sind anderweitig rechtlich geschützt. Falls Sie diese Email irrtümlich erhalten haben, benachrichtigen Sie uns bitte unverzüglich und löschen Sie anschließend die Email. Es ist untersagt, diese Email oder deren Inhalt zu kopieren oder Dritten zugänglich zu machen. Wir behalten uns das Recht vor, jegliche an bzw. von Beta Systems gesendeten Nachrichten zu überprüfen, um die Einhaltung unserer internen Richtlinien sowie die Wahrung unserer Geschäftsinteressen zu gewährleisten. Da Emails nicht sicher sind, kann eine fehlerfreie Übermittlung nicht gewährleistet werden. Emails können abgefangen und modifiziert oder zerstört werden, verloren gehen oder Viren enthalten. Die Kommunikation mit Beta Systems per Email geschieht auf eigene Gefahr. Mandatory Information for business email according to German trade laws / Pflichtangaben für geschäftliche Emails gemäß Handelsgesetzbuch und Aktiengesetz: Beta Systems Software AG Alt-Moabit 90d 10559 Berlin Germany Phone: +49-(0)30-726 118-0 Fax: +49-(0)30-726 118-800 i...@betasystems.com Chairman of the supervisory board / Vorsitzender des Aufsichtsrats: Dr. Günter Lewald Management board / Vorstand: Jürgen Herbott (CEO/Vorstandsvorsitzender), Gernot Sagl (CFO) Legal form / Rechtsform: Aktiengesellschaft Registered office / Sitz: Berlin Commercial register / Handelsregister: Berlin Charlottenburg, HRB 38 874 Ust-ID-Nr.: DE 136572034, St.-Nr.: DE 29/1/3927 Bank / Bankverbindung: Deutsche Bank Berlin, BLZ 1007 Account No / Konto-Nr.: 0680488 BIC DEUTDEBB, IBAN: DE94 1007 0068 0488 00
Re: Listview excel
Hi! Just change the mime type of the page to application/vnd.ms-excel. ** Martin 2010/8/30 Altuğ Bilgin Altıntaş alt...@gmail.com: Hi all; Is it possible to export a ListView to excel. Should i use always Datatable ? Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview excel
Thanks; I added table in to WebMarkupContainer and WebMarkupContainer in to getRequestCycle().setRequestTarget( new ComponentRequestTarget(table)); It works. 2010/8/30 Martin Makundi martin.maku...@koodaripalvelut.com Hi! Just change the mime type of the page to application/vnd.ms-excel. ** Martin 2010/8/30 Altuğ Bilgin Altıntaş alt...@gmail.com: Hi all; Is it possible to export a ListView to excel. Should i use always Datatable ? Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView in a Form -- issue with properties
hi, just add the form wicket id in property file. e.g. wicket:id=xxxForm -wicket:id=valueListView -wicket:id=value xxxForm.valueListView.value.Required=please enter the value Trevor Baker-2 wrote: Hi, I have a form that has an ListView (wicket:id=”valueListView”) of a bunch of required text fields (wicket:id=”value”). In my WebApplication.properties, I have: form.valueListView.value.Required=Please enter the Value However when I submit the form, in my error feedback if the field is blank it always displays the default: Field 'value is required. What is the proper way to write the property so it displays my custom error feedback message? Thanks, Trev -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-in-a-Form-issue-with-properties-tp2281199p2282008.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView in a Form -- issue with properties
Try with just value.Required On Wed, Jul 7, 2010 at 11:57 AM, Trevor Baker amoebawo...@gmail.com wrote: Hi, I have a form that has an ListView (wicket:id=”valueListView”) of a bunch of required text fields (wicket:id=”value”). In my WebApplication.properties, I have: form.valueListView.value.Required=Please enter the Value However when I submit the form, in my error feedback if the field is blank it always displays the default: Field 'value is required. What is the proper way to write the property so it displays my custom error feedback message? Thanks, Trev -- Jeremy Thomerson http://www.wickettraining.com
Re: Listview and hibernate question: Objects don't get deleted before the listview getObject() is called
How are you managing transactions? On Fri, Jun 25, 2010 at 7:27 AM, pieter claassen pieter.claas...@gmail.com wrote: I find that when I delete objects from my ListView, my model object for the ListView still contains a reference to the object. When the view tries to render, the object is already removed from the database and I get a null response on my hibernate load(). I use opensessioninview and when I check my logs, the delete statement comes way after the view was rendered. It seems that ListView renders the new view before the transaction is closed (but even then, the delete should be visible to later sql in the same transaction). Any ideas? Regards, Pieter Log: Hibernate: delete from ABSTRACTDATASET where ID=? ListView: === ListView documents = new ListView(documents, new IModel() { public Object getObject() { return getDocumentList(); } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview and hibernate question: Objects don't get deleted before the listview getObject() is called
No, my DAO's inherit from HibernateDaoSupport and I just go with the defaults. Regards, Pieter On Fri, Jun 25, 2010 at 2:22 PM, James Carman ja...@carmanconsulting.comwrote: How are you managing transactions? On Fri, Jun 25, 2010 at 7:27 AM, pieter claassen pieter.claas...@gmail.com wrote: I find that when I delete objects from my ListView, my model object for the ListView still contains a reference to the object. When the view tries to render, the object is already removed from the database and I get a null response on my hibernate load(). I use opensessioninview and when I check my logs, the delete statement comes way after the view was rendered. It seems that ListView renders the new view before the transaction is closed (but even then, the delete should be visible to later sql in the same transaction). Any ideas? Regards, Pieter Log: Hibernate: delete from ABSTRACTDATASET where ID=? ListView: === ListView documents = new ListView(documents, new IModel() { public Object getObject() { return getDocumentList(); } -- Pieter Claassen musmato.com
Re: Listview and hibernate question: Objects don't get deleted before the listview getObject() is called
are you using a loadable detachable model or? 2010/6/25 pieter claassen pieter.claas...@gmail.com I find that when I delete objects from my ListView, my model object for the ListView still contains a reference to the object. When the view tries to render, the object is already removed from the database and I get a null response on my hibernate load(). I use opensessioninview and when I check my logs, the delete statement comes way after the view was rendered. It seems that ListView renders the new view before the transaction is closed (but even then, the delete should be visible to later sql in the same transaction). Any ideas? Regards, Pieter Log: Hibernate: delete from ABSTRACTDATASET where ID=? ListView: === ListView documents = new ListView(documents, new IModel() { public Object getObject() { return getDocumentList(); }
Re: Listview and hibernate question: Objects don't get deleted before the listview getObject() is called
Yes, I reload the objects using my DAOs but, I have 2 MySQL databases on the backend and so far have not been using @Transactional. This might be the problem. Now I just have to figure out to configure tx:annotation-driven transaction-manager=txManager / for more than one transaction manager and make sure the different DOAs use the right txManager. Regards, Pieter On Fri, Jun 25, 2010 at 3:30 PM, nino martinez wael nino.martinez.w...@gmail.com wrote: yeah and grabbig from the dao each time right? 2010/6/25 pieter claassen pieter.claas...@gmail.com Nino, No, in this case, I created an inline IModel and overrode the getObject() method. Pieter On Fri, Jun 25, 2010 at 2:59 PM, nino martinez wael nino.martinez.w...@gmail.com wrote: are you using a loadable detachable model or? 2010/6/25 pieter claassen pieter.claas...@gmail.com I find that when I delete objects from my ListView, my model object for the ListView still contains a reference to the object. When the view tries to render, the object is already removed from the database and I get a null response on my hibernate load(). I use opensessioninview and when I check my logs, the delete statement comes way after the view was rendered. It seems that ListView renders the new view before the transaction is closed (but even then, the delete should be visible to later sql in the same transaction). Any ideas? Regards, Pieter Log: Hibernate: delete from ABSTRACTDATASET where ID=? ListView: === ListView documents = new ListView(documents, new IModel() { public Object getObject() { return getDocumentList(); } -- Pieter Claassen musmato.com -- Pieter Claassen musmato.com
Re: Listview and hibernate question: Objects don't get deleted before the listview getObject() is called
These discussions might be of interest to you: https://jira.springsource.org/browse/SPR-3955 http://forum.springsource.org/showthread.php?t=27754 On Fri, Jun 25, 2010 at 9:34 AM, pieter claassen pieter.claas...@gmail.com wrote: Yes, I reload the objects using my DAOs but, I have 2 MySQL databases on the backend and so far have not been using @Transactional. This might be the problem. Now I just have to figure out to configure tx:annotation-driven transaction-manager=txManager / for more than one transaction manager and make sure the different DOAs use the right txManager. Regards, Pieter On Fri, Jun 25, 2010 at 3:30 PM, nino martinez wael nino.martinez.w...@gmail.com wrote: yeah and grabbig from the dao each time right? 2010/6/25 pieter claassen pieter.claas...@gmail.com Nino, No, in this case, I created an inline IModel and overrode the getObject() method. Pieter On Fri, Jun 25, 2010 at 2:59 PM, nino martinez wael nino.martinez.w...@gmail.com wrote: are you using a loadable detachable model or? 2010/6/25 pieter claassen pieter.claas...@gmail.com I find that when I delete objects from my ListView, my model object for the ListView still contains a reference to the object. When the view tries to render, the object is already removed from the database and I get a null response on my hibernate load(). I use opensessioninview and when I check my logs, the delete statement comes way after the view was rendered. It seems that ListView renders the new view before the transaction is closed (but even then, the delete should be visible to later sql in the same transaction). Any ideas? Regards, Pieter Log: Hibernate: delete from ABSTRACTDATASET where ID=? ListView: === ListView documents = new ListView(documents, new IModel() { public Object getObject() { return getDocumentList(); } -- Pieter Claassen musmato.com -- Pieter Claassen musmato.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview and hibernate question: Objects don't get deleted before the listview getObject() is called
Looks like if you use Spring 3.x, you can do it. You have to use the value of the @Transactional annotation to figure out which tx manager to use. On Fri, Jun 25, 2010 at 9:58 AM, James Carman ja...@carmanconsulting.com wrote: These discussions might be of interest to you: https://jira.springsource.org/browse/SPR-3955 http://forum.springsource.org/showthread.php?t=27754 On Fri, Jun 25, 2010 at 9:34 AM, pieter claassen pieter.claas...@gmail.com wrote: Yes, I reload the objects using my DAOs but, I have 2 MySQL databases on the backend and so far have not been using @Transactional. This might be the problem. Now I just have to figure out to configure tx:annotation-driven transaction-manager=txManager / for more than one transaction manager and make sure the different DOAs use the right txManager. Regards, Pieter On Fri, Jun 25, 2010 at 3:30 PM, nino martinez wael nino.martinez.w...@gmail.com wrote: yeah and grabbig from the dao each time right? 2010/6/25 pieter claassen pieter.claas...@gmail.com Nino, No, in this case, I created an inline IModel and overrode the getObject() method. Pieter On Fri, Jun 25, 2010 at 2:59 PM, nino martinez wael nino.martinez.w...@gmail.com wrote: are you using a loadable detachable model or? 2010/6/25 pieter claassen pieter.claas...@gmail.com I find that when I delete objects from my ListView, my model object for the ListView still contains a reference to the object. When the view tries to render, the object is already removed from the database and I get a null response on my hibernate load(). I use opensessioninview and when I check my logs, the delete statement comes way after the view was rendered. It seems that ListView renders the new view before the transaction is closed (but even then, the delete should be visible to later sql in the same transaction). Any ideas? Regards, Pieter Log: Hibernate: delete from ABSTRACTDATASET where ID=? ListView: === ListView documents = new ListView(documents, new IModel() { public Object getObject() { return getDocumentList(); } -- Pieter Claassen musmato.com -- Pieter Claassen musmato.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView + dynamic rows: always remove last row...
Even Im trying to implement the remove link as: - item.add(removeLink(removeKeyword, item)); and it doesnt work... always remove the last row... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-dynamic-rows-always-remove-last-row-tp2260480p2261045.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView + dynamic rows: always remove last row...
Try to use the RemoveLink that is available as inner class of ListView. Regards, Erik. Op 18-06-10 18:29, jOki wrote: Hi!! Im trying to implement a dynamic Form, where you can add textfields and remove as you want. The add button works fine, but the remove button always remove the last testfield and not the selected field. For example: Textfield1 add remove Textfield2 add remove Textfield3 add remove click on remove (row textfield2) and Textfield3 is removed. It should remove Textfield2, doesnt it? Some code: public class KeywordObject implements Serializable { private static final long serialVersionUID = 1L; private String keyword; public void setKeyword(String keyword) { this.keyword = keyword; } public String getKeyword() { return this.keyword; } } And in the form... ListKeywordObject keyList = new ArrayListKeywordObject(); keyList.add(new KeywordObject()); final ListView keywordView = new ListView(keywordView, keyList) { @Override protected void populateItem(final ListItem item) { KeywordObject model = (KeywordObject) item.getModelObject(); item.add(new TextField(keyword, new PropertyModel(model, keyword))); // keyword add link Link addKeyword = new Link(addKeyword, item.getModel()) { @Override public void onClick() { keyList.add(new KeywordObject()); } }; // keyword remove link Link removeKeyword = new Link(removeKeyword, item.getModel()) { @Override public void onClick() { KeywordObject selected = (KeywordObject) getModelObject(); keyList.remove(selected); } }; item.add(addKeyword); item.add(removeKeyword); } }; add(keywordView); keywordView.setReuseItems(true); Im getting crazy about that... Thanks. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView + dynamic rows: always remove last row...
Just as a test, turn off the reuseItems property. See what happens. On Sat, Jun 19, 2010 at 5:04 AM, jOki joa...@gmail.com wrote: Even Im trying to implement the remove link as: - item.add(removeLink(removeKeyword, item)); and it doesnt work... always remove the last row... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-dynamic-rows-always-remove-last-row-tp2260480p2261045.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView + dynamic rows: always remove last row...
Also, is the item you're trying to remove a null in the list? Or, is it a problem with equals/hashcode not being implemented correctly? I just fixed a bug in ListView this week with the remove link and move up/down links. It was relying on the equals of the model object of the item to find which to remove. Now it removes by index. But I think James is on to the right answer for your case. On Sat, Jun 19, 2010 at 7:50 AM, James Carman ja...@carmanconsulting.comwrote: Just as a test, turn off the reuseItems property. See what happens. On Sat, Jun 19, 2010 at 5:04 AM, jOki joa...@gmail.com wrote: Even Im trying to implement the remove link as: - item.add(removeLink(removeKeyword, item)); and it doesnt work... always remove the last row... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-dynamic-rows-always-remove-last-row-tp2260480p2261045.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jeremy Thomerson http://www.wickettraining.com
Re: ListView + dynamic rows: always remove last row...
Hi, I tried with/without setReuseItems and the behaviour is the same. I think you can be right with equals/hashcode not being implemented correctly... I tried another time with a ListString with different values and its working... I tried as well to implement these methods (equals/hashcode) in my code but it doesnt work. How can I differentiate objects even if when they are added (they are textfields) they just have empty values Thanks for the help! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-dynamic-rows-always-remove-last-row-tp2260480p2261292.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView + dynamic rows: always remove last row...
What kind of objects are they? For entities, I use a uuid for the primary key and it's assigned when the object is created. That way you make equals/hashcode based on the uuid so that everything stays consistent On Jun 19, 2010 1:42 PM, jOki joa...@gmail.com wrote: Hi, I tried with/without setReuseItems and the behaviour is the same. I think you can be right with equals/hashcode not being implemented correctly... I tried another time with a ListString with different values and its working... I tried as well to implement these methods (equals/hashcode) in my code but it doesnt work. How can I differentiate objects even if when they are added (they are textfields) they just have empty values Thanks for the help! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-dynamic-rows-always-remove-last-row-tp2260480p2261292.html Sent from the Wicket - User mailing list archive at Nabble.com. ---...
Re: ListView highlight selected row
Igor, you are right. It is still not rendered when i do the super.onComponentTag after the tag.put. This is the markup for the listview. zoekresultaat is the id for the listview. When the page is rendered the first time it works fine, but not in Ajax updates. In the debugger is see that on the selected item the put is done, but i don't see it rendered. Thanks table wicket:id=tabel tbody tr th style=width:20px/th th style=width:105px;Contactmoment/th thOmschrijving/th /tr tr wicket:id=zoekresultaat bgcolor=#FF onmouseover=this.bgColor='gold'; onmouseout=this.bgColor='#FF'; td[x]/td td # /td td[blabla]/td /tr /tbody /table -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-highlight-selected-row-tp2197486p2224291.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView highlight selected row
so its not rendered in markup? or its rendered in markup but you dont see the effect? if latter its most likely a css issue, if former create a quickstart and attach it to a jira issue. -igor On 5/20/10, JeroenWolff jeroen.wo...@gmail.com wrote: Igor, you are right. It is still not rendered when i do the super.onComponentTag after the tag.put. This is the markup for the listview. zoekresultaat is the id for the listview. When the page is rendered the first time it works fine, but not in Ajax updates. In the debugger is see that on the selected item the put is done, but i don't see it rendered. Thanks table wicket:id=tabel tbody tr th style=width:20px/th th style=width:105px;Contactmoment/th thOmschrijving/th /tr tr wicket:id=zoekresultaat bgcolor=#FF onmouseover=this.bgColor='gold'; onmouseout=this.bgColor='#FF'; td[x]/td td # /td td[blabla]/td /tr /tbody /table -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-highlight-selected-row-tp2197486p2224291.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView highlight selected row
thanks, it is not rendered in the html (view source in browser) when i disable Javascript it works fine! I will put it in the quickstart and report it in Jira thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-highlight-selected-row-tp2197486p2225133.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView highlight selected row
maybe your javascript is overriding it -igor On Thu, May 20, 2010 at 12:04 PM, JeroenWolff jeroen.wo...@gmail.com wrote: thanks, it is not rendered in the html (view source in browser) when i disable Javascript it works fine! I will put it in the quickstart and report it in Jira thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-highlight-selected-row-tp2197486p2225133.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView highlight selected row
Now i've got it working with the quickstart and a simple ListView. Now i have to find out the difference and why it is now working..,now working on jetty...tomorrow i test it on Websphere... Thanks! public class HomePage extends WebPage { private Contact selected = new Contact(); @SuppressWarnings(serial) public HomePage(final PageParameters parameters) { final WebMarkupContainer table = new WebMarkupContainer(table); PageableListViewContact listView = new PageableListViewContact( contactrow, getContacts(), 4) { @Override protected ListItemContact newItem(int index) { ListItemContact item = new ListItemContact(index, getListItemModel(getModel(), index)) { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (getModelObject() == selected) { tag.put(class, selected); } } }; return item; } @Override protected void populateItem(final ListItemContact item) { Contact contact = item.getModelObject(); final AjaxFallbackLinkContact contactDateLink = new AjaxFallbackLinkContact( link) { @Override public void onClick(AjaxRequestTarget target) { selected = (Contact) getParent().getDefaultModelObject(); if (target != null) { target.addComponent(table); } } }; contactDateLink.add(new Label(linklabel, contact.getContactDate().toString())); item.add(contactDateLink); item.add(new Label(code, contact.getCode())); item.add(new Label(description, contact.getDescription())); } }; table.setOutputMarkupId(true); table.add(listView); add(table); add(new AjaxPagingNavigator(navigator, listView)); } public static ListContact getContacts() { ListContact resultList = new ArrayListContact(); Contact contact = new Contact(A, new Date(), description1); resultList.add(contact); contact = new Contact(B, new Date(), description2); resultList.add(contact); contact = new Contact(C, new Date(), description3); resultList.add(contact); contact = new Contact(D, new Date(), description4); resultList.add(contact); return resultList; } } @SuppressWarnings(serial) class Contact implements Serializable { private String code; private Date contactDate; private String description; public Contact() { super(); } public Contact(String code, Date contactDate, String description) { super(); this.code = code; this.contactDate = contactDate; this.description = description; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public Date getContactDate() { return contactDate; } public void setContactDate(Date contactDate) { this.contactDate = contactDate; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } } body table wicket:id=table tbody tr th style=width: 20px/th th style=width: 105px;ContactDate/th thDescription/th
Re: ListView highlight selected row
Ah - the beauty of creating a quickstart. It almost always makes us go back and see what other weird combination of things is actually creating the issue :) -- Jeremy Thomerson http://www.wickettraining.com On Thu, May 20, 2010 at 3:18 PM, JeroenWolff jeroen.wo...@gmail.com wrote: Now i've got it working with the quickstart and a simple ListView. Now i have to find out the difference and why it is now working..,now working on jetty...tomorrow i test it on Websphere... Thanks! public class HomePage extends WebPage { private Contact selected = new Contact(); @SuppressWarnings(serial) public HomePage(final PageParameters parameters) { final WebMarkupContainer table = new WebMarkupContainer(table); PageableListViewContact listView = new PageableListViewContact( contactrow, getContacts(), 4) { @Override protected ListItemContact newItem(int index) { ListItemContact item = new ListItemContact(index, getListItemModel(getModel(), index)) { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (getModelObject() == selected) { tag.put(class, selected); } } }; return item; } @Override protected void populateItem(final ListItemContact item) { Contact contact = item.getModelObject(); final AjaxFallbackLinkContact contactDateLink = new AjaxFallbackLinkContact( link) { @Override public void onClick(AjaxRequestTarget target) { selected = (Contact) getParent().getDefaultModelObject(); if (target != null) { target.addComponent(table); } } }; contactDateLink.add(new Label(linklabel, contact.getContactDate().toString())); item.add(contactDateLink); item.add(new Label(code, contact.getCode())); item.add(new Label(description, contact.getDescription())); } }; table.setOutputMarkupId(true); table.add(listView); add(table); add(new AjaxPagingNavigator(navigator, listView)); } public static ListContact getContacts() { ListContact resultList = new ArrayListContact(); Contact contact = new Contact(A, new Date(), description1); resultList.add(contact); contact = new Contact(B, new Date(), description2); resultList.add(contact); contact = new Contact(C, new Date(), description3); resultList.add(contact); contact = new Contact(D, new Date(), description4); resultList.add(contact); return resultList; } } @SuppressWarnings(serial) class Contact implements Serializable { private String code; private Date contactDate; private String description; public Contact() { super(); } public Contact(String code, Date contactDate, String description) { super(); this.code = code; this.contactDate = contactDate; this.description = description; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public Date getContactDate() { return contactDate; } public void setContactDate(Date contactDate) { this.contactDate = contactDate; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } } body table wicket:id=table tbody tr
Re: ListView highlight selected row
Igor, thanks you've helped me a lot...but now i repaint the whole table and on every onComponentTag i update the class if the item is selected or not. I see in the debugger that onComponentTag and the tag.put(class, selected) but it is not rendered. What do i do wrong?? Thanks!! This is my code: public class HomePage extends BasePage { private KlantContact selected = new KlantContact(); private Panel detailPanel = new DetailPanel(details, selected); private PageableListViewKlantContact listView = null; private ListKlantContact klantContacten = null; @SpringBean private KlantContactDAO dao; public HomePage(PageParameters parameters) { String bsn = parameters.getString(bsn); InjectorHolder.getInjector().inject(this); final WebMarkupContainer tabel = new WebMarkupContainer(tabel); klantContacten = dao.geefKlantContactenVanDeLaatste2Maanden(bsn, new LocalDateTime()); listView = new PageableListViewKlantContact(zoekresultaat, klantContacten, 5) { private static final long serialVersionUID = 1L; @Override protected ListItemKlantContact newItem(int index) { ListItemKlantContact item = new ListItemKlantContact(index, getListItemModel(getModel(), index)) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (getModelObject() == selected) { tag.put(class, welselected); } else { tag.put(class, notselected); } } }; item.setOutputMarkupId(true); return item; } @Override protected void populateItem(final ListItemKlantContact item) { KlantContact contact = item.getModelObject(); final AjaxFallbackLinkKlantContact contactDatumLink = new AjaxFallbackLinkKlantContact( contactdatumlink) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { // het geselecteerde KlantContact bepalen selected = (KlantContact) getParent() .getDefaultModelObject(); // het detailpanel vervangen met een nieuw detailpanel // waar de gelecteerde klantcontact details op komen. DetailPanel replacement = new DetailPanel(details, selected); replacement.setOutputMarkupId(true); detailPanel.replaceWith(replacement); detailPanel = replacement; if (target != null) { target.addComponent(detailPanel); // render de listview opnieuw om de selected css te zetten target.addComponent(tabel); } } }; contactDatumLink.add(new Label(contactdatumlinklabel, new PropertyModelKlantContact(contact, getContactDatumTijdDDMMYYHHMM))); item.add(contactDatumLink); item.add(new Label(soort, contact.getContactWijze())); item.add(new Label(omschrijving, contact .getOmschrijving())); }
Re: ListView highlight selected row
try doing the tag.put(class, foo) BEFORE the super.onComponentTag - which is where the tag is rendered -- Jeremy Thomerson http://www.wickettraining.com On Wed, May 19, 2010 at 1:48 AM, JeroenWolff jeroen.wo...@gmail.com wrote: Igor, thanks you've helped me a lot...but now i repaint the whole table and on every onComponentTag i update the class if the item is selected or not. I see in the debugger that onComponentTag and the tag.put(class, selected) but it is not rendered. What do i do wrong?? Thanks!! This is my code: public class HomePage extends BasePage { private KlantContact selected = new KlantContact(); private Panel detailPanel = new DetailPanel(details, selected); private PageableListViewKlantContact listView = null; private ListKlantContact klantContacten = null; @SpringBean private KlantContactDAO dao; public HomePage(PageParameters parameters) { String bsn = parameters.getString(bsn); InjectorHolder.getInjector().inject(this); final WebMarkupContainer tabel = new WebMarkupContainer(tabel); klantContacten = dao.geefKlantContactenVanDeLaatste2Maanden(bsn, new LocalDateTime()); listView = new PageableListViewKlantContact(zoekresultaat, klantContacten, 5) { private static final long serialVersionUID = 1L; @Override protected ListItemKlantContact newItem(int index) { ListItemKlantContact item = new ListItemKlantContact(index, getListItemModel(getModel(), index)) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (getModelObject() == selected) { tag.put(class, welselected); } else { tag.put(class, notselected); } } }; item.setOutputMarkupId(true); return item; } @Override protected void populateItem(final ListItemKlantContact item) { KlantContact contact = item.getModelObject(); final AjaxFallbackLinkKlantContact contactDatumLink = new AjaxFallbackLinkKlantContact( contactdatumlink) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { // het geselecteerde KlantContact bepalen selected = (KlantContact) getParent() .getDefaultModelObject(); // het detailpanel vervangen met een nieuw detailpanel // waar de gelecteerde klantcontact details op komen. DetailPanel replacement = new DetailPanel(details, selected); replacement.setOutputMarkupId(true); detailPanel.replaceWith(replacement); detailPanel = replacement; if (target != null) { target.addComponent(detailPanel); // render de listview opnieuw om de selected css te zetten target.addComponent(tabel); } } }; contactDatumLink.add(new Label(contactdatumlinklabel, new PropertyModelKlantContact(contact, getContactDatumTijdDDMMYYHHMM))); item.add(contactDatumLink); item.add(new Label(soort, contact.getContactWijze())); item.add(new Label(omschrijving, contact .getOmschrijving())); } }; tabel.setOutputMarkupId(true);
Re: ListView highlight selected row
no, i dont think its rendered in the super called, only prepared for rendering so his code should work just fine. set a breakpoint and see if its being called. also what markup is the listview attached to? -igor On Tue, May 18, 2010 at 11:51 PM, Jeremy Thomerson jer...@wickettraining.com wrote: try doing the tag.put(class, foo) BEFORE the super.onComponentTag - which is where the tag is rendered -- Jeremy Thomerson http://www.wickettraining.com On Wed, May 19, 2010 at 1:48 AM, JeroenWolff jeroen.wo...@gmail.com wrote: Igor, thanks you've helped me a lot...but now i repaint the whole table and on every onComponentTag i update the class if the item is selected or not. I see in the debugger that onComponentTag and the tag.put(class, selected) but it is not rendered. What do i do wrong?? Thanks!! This is my code: public class HomePage extends BasePage { private KlantContact selected = new KlantContact(); private Panel detailPanel = new DetailPanel(details, selected); private PageableListViewKlantContact listView = null; private ListKlantContact klantContacten = null; �...@springbean private KlantContactDAO dao; public HomePage(PageParameters parameters) { String bsn = parameters.getString(bsn); InjectorHolder.getInjector().inject(this); final WebMarkupContainer tabel = new WebMarkupContainer(tabel); klantContacten = dao.geefKlantContactenVanDeLaatste2Maanden(bsn, new LocalDateTime()); listView = new PageableListViewKlantContact(zoekresultaat, klantContacten, 5) { private static final long serialVersionUID = 1L; �...@override protected ListItemKlantContact newItem(int index) { ListItemKlantContact item = new ListItemKlantContact(index, getListItemModel(getModel(), index)) { private static final long serialVersionUID = 1L; �...@override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (getModelObject() == selected) { tag.put(class, welselected); } else { tag.put(class, notselected); } } }; item.setOutputMarkupId(true); return item; } �...@override protected void populateItem(final ListItemKlantContact item) { KlantContact contact = item.getModelObject(); final AjaxFallbackLinkKlantContact contactDatumLink = new AjaxFallbackLinkKlantContact( contactdatumlink) { private static final long serialVersionUID = 1L; �...@override public void onClick(AjaxRequestTarget target) { // het geselecteerde KlantContact bepalen selected = (KlantContact) getParent() .getDefaultModelObject(); // het detailpanel vervangen met een nieuw detailpanel // waar de gelecteerde klantcontact details op komen. DetailPanel replacement = new DetailPanel(details, selected); replacement.setOutputMarkupId(true); detailPanel.replaceWith(replacement); detailPanel = replacement; if (target != null) { target.addComponent(detailPanel); // render de listview opnieuw om de selected css te zetten target.addComponent(tabel); } } }; contactDatumLink.add(new Label(contactdatumlinklabel, new PropertyModelKlantContact(contact, getContactDatumTijdDDMMYYHHMM))); item.add(contactDatumLink);
Re: ListView highlight selected row
Thanks Igor... But i forgot to tell...my app is a single page app with only Ajax replacements. Is it possible to click on a (Ajax) link in de (Pageable)ListView and replace the ListView with a changed style on the selected Item? now in my Ajax onClick i have target.addChildren(listView, Label.class); to update the Labels in the listview, but how can i change the Attribute of that selected Item? Thanks, Jeroen -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-highlight-selected-row-tp2197486p2220309.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView highlight selected row
repaint the item, eg add it to the target -igor On Mon, May 17, 2010 at 1:30 PM, JeroenWolff jeroen.wo...@gmail.com wrote: Thanks Igor... But i forgot to tell...my app is a single page app with only Ajax replacements. Is it possible to click on a (Ajax) link in de (Pageable)ListView and replace the ListView with a changed style on the selected Item? now in my Ajax onClick i have target.addChildren(listView, Label.class); to update the Labels in the listview, but how can i change the Attribute of that selected Item? Thanks, Jeroen -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-highlight-selected-row-tp2197486p2220309.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView highlight selected row
add(new listview() { item newitem(...) { return new item(..) { oncomponenttag(tag) { super.oncomponenttag(tag); if (getmodelobject().equals(selectedobject) { tag.put(class, selected); -igor On Thu, May 13, 2010 at 5:47 AM, JeroenWolff jeroen.wo...@gmail.com wrote: Hi, i'm a wicket newbee...i've got a ListView with a AjaxLink so the selected 'customer' details will be shown in a detailed panel. But now i would like to highlite the selected 'customer' row in de ListView so the user can see which row he/she selected. How can i do this? Thanks, Jeroen -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-highlight-selected-row-tp2197486p2197486.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView and Serialization
Hi Michael, there's no requirement for components inside ListView to be stateless - I wonder were you got that from. You can have Links, Buttons or anything else in there so removing all on detach is a recipe for disaster for the next incoming request. Sven Michael Gottschalk wrote: Hi, I have a question concerning the serialization of subcomponents of ListView. If I understand correctly, then the components that are added to a ListView in the populateItem method should be stateless, since they are removed in the onPopulate method each time the list view is rendered (as long as reuseItems is set to false). Nevertheless, the subcomponents are saved in the ListView and so they are serialized/stored in the session after the page with the ListView has been rendered. This seems unnecessary to me. Why do we have to store components that are discarded before the next rendering phase anyway? So I created a subclass of ListView with the following method overridden: @Override protected void onDetach() { super.onDetach(); if ( !getReuseItems() ) { removeAll(); } } This removes the subcomponents before the page is stored in the session and should save some memory in most cases. Is there a reason why this is not done in ListView itself? Has nobody thought about it yet or could there be any problems with this approach? Cheers, Michael - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView and Serialization
Hi Sven, you wrote: there's no requirement for components inside ListView to be stateless - I wonder were you got that from. I got that from the ListView class comment and from studying the code. The comment says: By default, setReuseItems is false, which has the effect that ListView replaces all child components by new instances. The idea behind this is that you always render the fresh data, and as people usually use ListViews for displaying read-only lists [...]. You can have Links, Buttons or anything else in there so removing all on detach is a recipe for disaster for the next incoming request. I don't think so, because removeAll is already called in ListView. In onPopulate, which is called in onBeforeRender by AbstractRepeater, the following can be found: if (getReuseItems()) { [...] } else { // Automatically rebuild all ListItems before rendering the // list view removeAll(); } ... then the components are recreated using populateItem. In my opinion, the only difference in my proposal is to call removeAll earlier: not in onBeforeRender of the next request cycle, but in onDetach of the current request cycle. Cheers, Michael - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView and Serialization
Hi Michael, the only difference in my proposal is to call removeAll earlier: not in onBeforeRender of the next request cycle, but in onDetach of the current request cycle. it makes a huge difference: If you call removeAll in onDetach, the next request to a component inside the ListView will no longer find its receiver: populateItem(ListItem item) { item.add(new Link(link) { onClick() { // how should this link be clicked when all components are already removed?? } }); } Sven Michael Gottschalk wrote: Hi Sven, you wrote: there's no requirement for components inside ListView to be stateless - I wonder were you got that from. I got that from the ListView class comment and from studying the code. The comment says: By default, setReuseItems is false, which has the effect that ListView replaces all child components by new instances. The idea behind this is that you always render the fresh data, and as people usually use ListViews for displaying read-only lists [...]. You can have Links, Buttons or anything else in there so removing all on detach is a recipe for disaster for the next incoming request. I don't think so, because removeAll is already called in ListView. In onPopulate, which is called in onBeforeRender by AbstractRepeater, the following can be found: if (getReuseItems()) { [...] } else { // Automatically rebuild all ListItems before rendering the // list view removeAll(); } ... then the components are recreated using populateItem. In my opinion, the only difference in my proposal is to call removeAll earlier: not in onBeforeRender of the next request cycle, but in onDetach of the current request cycle. Cheers, Michael - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView and Serialization
Hi Sven, Am Freitag, 26. März 2010 schrieb Sven Meier: the only difference in my proposal is to call removeAll earlier: not in onBeforeRender of the next request cycle, but in onDetach of the current request cycle. it makes a huge difference: If you call removeAll in onDetach, the next request to a component inside the ListView will no longer find its receiver: populateItem(ListItem item) { item.add(new Link(link) { onClick() { // how should this link be clicked when all components are already removed?? } }); } Yes, you are right, thank you! I did not think of the possibility that something could happen before onBeforeRender is called. However, for my use case, this is not a problem, since I only use stateless components in many of my list views anyway. I would then create a StatelessListView with my optimization and only use it if I know that I have only stateless child components. Cheers, Michael - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView + dynamic database Model
On 03/02/10 11:55, marioosh.net wrote: Sorry for my poor english ;) I have ListView and model like below. I need tabs to reload sometimes, so my model is dynamic and get tabs from database. But i see that something is wrong. When i want to get Tab object by getModelObject() in populateItem method i suppoused that i got it directly, but i see that all the times the getObject() method of model is triggered making for all items new list (new db request) ! That's exactly what is supposed to happen, as getModelObject() is just a shorthand for getModel().getObject(). And in your getObject(), you do the database request. If you need to avoid those database reloads, look into LoadableDetachableModels. -- Thomas How to get Tab objects for items without making wasting time database request ??? IModel model = new IModel() { public Object getObject() { System.out.println(getObject...); ... // getting list from DB ListTab list = ; return list; } public void setObject(Object object) {} public void detach() { }}; ListView tabs = new ListView(tabs, model) { @Override protected void populateItem(ListItem item) { item.getModelObject(); /*- new list, and new list, and new list.. :( } }; -- --- Thomas Kapplerthomas.kapp...@isb-sib.ch Swiss Institute of Bioinformatics Tel: +41 22 379 51 89 CMU, rue Michel Servet 1 1211 Geneve 4 Switzerland http://www.uniprot.org --- - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView + dynamic database Model
Thomas Kappler-3 wrote: On 03/02/10 11:55, marioosh.net wrote: Sorry for my poor english ;) I have ListView and model like below. I need tabs to reload sometimes, so my model is dynamic and get tabs from database. But i see that something is wrong. When i want to get Tab object by getModelObject() in populateItem method i suppoused that i got it directly, but i see that all the times the getObject() method of model is triggered making for all items new list (new db request) ! That's exactly what is supposed to happen, as getModelObject() is just a shorthand for getModel().getObject(). And in your getObject(), you do the database request. If you need to avoid those database reloads, look into LoadableDetachableModels. -- Thomas Thank You very much Thomas. I move code from getObject() method in IModel to load() method in LoadableDetachableModel and everything works! - no more useless requests to db :) LoadableDetachableModel model2 = new LoadableDetachableModel() { @Override protected Object load() { ... // getting list from DB ListTab list = ; return list; } }; -- View this message in context: http://old.nabble.com/ListView-%2B-dynamic-database-Model-tp27754495p27754908.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView and DropDownChoice reset all form fields ..
Hi and many thanks Martin ! just setting the setReuseItems is enough ... later, Arnaud 2010/2/22 Martin Makundi martin.maku...@koodaripalvelut.com: Hi! Yeah...try setReuseItems for your listView. If you use ajax, you can use also AjaxFormSubmittingChangeListenerBehavior http://old.nabble.com/New-behavior:-AjaxFormSubmittingChangeListenerBehavior-td26201382.html ** Martin 2010/2/22 Arnaud Garcia arn...@imagemed-87.com: Hi List, If you create a simple Panel with a DropDownChoice where you put wantOnSelectionChangedNotifications to true and onSelectionChanged... JUST your select box is re-rendered when your selection change, others panel fields are not re-renderer...(which is good). BUT if you put your panel in a ListView (because you want to display a lot of panels...), on the onSelectionChanged all the ListView childs are re-renderer and all the panels fields are reseted ! because there was no form processing yet (model and form fields are not setted yet) Any idea to deal with this problem ? thanks for help, Arnaud - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView and DropDownChoice reset all form fields ..
Hi! Yeah...try setReuseItems for your listView. If you use ajax, you can use also AjaxFormSubmittingChangeListenerBehavior http://old.nabble.com/New-behavior:-AjaxFormSubmittingChangeListenerBehavior-td26201382.html ** Martin 2010/2/22 Arnaud Garcia arn...@imagemed-87.com: Hi List, If you create a simple Panel with a DropDownChoice where you put wantOnSelectionChangedNotifications to true and onSelectionChanged... JUST your select box is re-rendered when your selection change, others panel fields are not re-renderer...(which is good). BUT if you put your panel in a ListView (because you want to display a lot of panels...), on the onSelectionChanged all the ListView childs are re-renderer and all the panels fields are reseted ! because there was no form processing yet (model and form fields are not setted yet) Any idea to deal with this problem ? thanks for help, Arnaud - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView Behavior
Hi! Why do you need to count items? You can refer to different components using their markupid. ** Martin 2010/1/4 wic...@geofflancaster.com wic...@geofflancaster.com: Due to Wicket handling things in a weird order, would anyone mind giving me a hand in solving this issue? When I create a ListView, populateItem() is called for each item in the list which is passed into the ListView and then it goes back and creates the Label named chart. The problem is that I'm trying to keep a counter on each chart item being created so I can render javascript on the component. See below for code and output (for a test with 2 items being passed in via the list in the ListView Constructor). BEGIN CODE-- addOrReplace(new ListViewStringBuilder(graphTable,xml){ �...@override protected void populateItem(ListItemStringBuilder item){ StringBuilder sb = (StringBuilder) item.getModelObject(); System.out.println(populating item number - +divNum); Label chart = new Label(chart,new Model()){ �...@override protected void onComponentTag(final ComponentTag tag){ System.out.println(adding componentTag with id=+divNum); super.onComponentTag(tag); tag.put(id, chart_+ divNum); } }; item.add(chart); Label script = new Label(script,parseJS(sb,chart_+divNum)); script.setRenderBodyOnly(true); script.setEscapeModelStrings(false); item.add(script); divNum++; } }); -- END CODE - -- BEGIN OUTPUT - populating item number - 0 populating item number - 1 adding componentTag with id=2 adding componentTag with id=2 --- END OUTPUT -- I need the componentTag to correspond with the numbers listed after populating item number for example, I need the output to show something to the affect of: populating item number - 0 adding componentTag with id=0 populating item number - 1 adding componentTag with id=1 or populating item number - 0 populating item number - 1 adding componentTag with id=0 adding componentTag with id=1 mail2web.com - Microsoft® Exchange solutions from a leading provider - http://link.mail2web.com/Business/Exchange - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView Behavior
Very good point. Didn't think about that. Thanks, I've solved my problem! Original Message: - From: Martin Makundi martin.maku...@koodaripalvelut.com Date: Mon, 4 Jan 2010 18:19:46 +0200 To: users@wicket.apache.org Subject: Re: ListView Behavior Hi! Why do you need to count items? You can refer to different components using their markupid. ** Martin 2010/1/4 wic...@geofflancaster.com wic...@geofflancaster.com: Due to Wicket handling things in a weird order, would anyone mind giving me a hand in solving this issue? When I create a ListView, populateItem() is called for each item in the list which is passed into the ListView and then it goes back and creates the Label named chart. The problem is that I'm trying to keep a counter on each chart item being created so I can render javascript on the component. See below for code and output (for a test with 2 items being passed in via the list in the ListView Constructor). BEGIN CODE-- addOrReplace(new ListViewStringBuilder(graphTable,xml){ �...@override protected void populateItem(ListItemStringBuilder item){ StringBuilder sb = (StringBuilder) item.getModelObject(); System.out.println(populating item number - +divNum); Label chart = new Label(chart,new Model()){ �...@override protected void onComponentTag(final ComponentTag tag){ System.out.println(adding componentTag with id=+divNum); super.onComponentTag(tag); tag.put(id, chart_+ divNum); } }; item.add(chart); Label script = new Label(script,parseJS(sb,chart_+divNum)); script.setRenderBodyOnly(true); script.setEscapeModelStrings(false); item.add(script); divNum++; } }); -- END CODE - -- BEGIN OUTPUT - populating item number - 0 populating item number - 1 adding componentTag with id=2 adding componentTag with id=2 --- END OUTPUT -- I need the componentTag to correspond with the numbers listed after populating item number for example, I need the output to show something to the affect of: populating item number - 0 adding componentTag with id=0 populating item number - 1 adding componentTag with id=1 or populating item number - 0 populating item number - 1 adding componentTag with id=0 adding componentTag with id=1 mail2web.com - Microsoft® Exchange solutions from a leading provider - http://link.mail2web.com/Business/Exchange - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org mail2web.com - Microsoft® Exchange solutions from a leading provider - http://link.mail2web.com/Business/Exchange - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview clears all the data in the textfileds after adding new element in the List
ListView always popupates rows with new elements. That's why their state is cleared. You have two options: 1. call listview.setReuseItems - this will keep the old rows 2. if you need something more fancy and want to repopulate the rows, you will need to use a reusemanager that can copy the component states from the previous components: http://old.nabble.com/Check%28box%29-loses-checked-state-after-error-td26079574.html ** Martin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview clears all the data in the textfileds after adding new element in the List
Hi, if you're using a Link, the browser won't send the edited values back to your application. Use a SubmitLink instead. Sven ayman elwany wrote: Hi All , I'm new to Apache Wicket , I started working with it from 2 weeks and I'm really enjoying it .but I have a little problem that I don't know what is the problem with it . I have a Listview contains three text fields as a table data raw with a Link which onClick adds a raw to the List view ,and everything works fine except that the text fields gets cleared whenever I Press the add Link and a new raw added . here is my Html Mark up *HTML:* tr wicket:id=employersList tdinput type=text wicket:id=companyName //td tdinput type=text wicket:id=startDate //td tdinput type=text wicket:id=endDate //td /tr tr tda wicket:id=add href=#add/a/td /tr *J**ava code:* *public class CarPage extends WebPage {* * .. * * ...* * ** *private ListEmployer employerList =new ArrayListEmployer(); public CarPage() { ** ** ListView employersListView=getEmployersListView(); add(employersListView); Link addLink=new Link(add) {...@override public void onClick() { // TODO Auto-generated method stub employerList.add(new Employer()); } }; add(addLink); } private ListView getEmployersListView() { // TODO Auto-generated method stub ListView employersListView=new ListView(employersList,employerList) { @Override protected void populateItem(ListItem item) { // TODO Auto-generated method stub Employer employer=(Employer)item.getModelObject(); item.add(new TextFieldString(companyName,new PropertyModelString(employer, companyName))); item.add(new DateTextField(startDate, new PropertyModelDate(employer, startDate), new StyleDateConverter( S-, true)).add(new DatePicker())); item.add(new DateTextField(endDate, new PropertyModelDate(employer, endDate), new StyleDateConverter( S-, true)).add(new DatePicker())); } }; return employersListView; } * ...* *...* } class Employer implements Serializable{ String companyName; Date startDate, endDate; //Setters and getters } Thanks in advnce ... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview clears all the data in the textfileds after adding new element in the List
Thanks Sven , it is working now , In the beginning it wasn't working at all but after that I put the ListView and submitLink in a form and then worked. Thanks again.. form wicket:id=ListForm tr tdstrongfont size=4Employer :/font/strong/td /tr tr wicket:id=employersList tdinput type=text wicket:id=companyName //td tdinput type=text wicket:id=startDate //td tdinput type=text wicket:id=endDate //td /tr tr tda wicket:id=add href=#add/a/td /tr /form On Fri, Dec 25, 2009 at 3:00 PM, Sven Meier s...@meiers.net wrote: Hi, if you're using a Link, the browser won't send the edited values back to your application. Use a SubmitLink instead. Sven ayman elwany wrote: Hi All , I'm new to Apache Wicket , I started working with it from 2 weeks and I'm really enjoying it .but I have a little problem that I don't know what is the problem with it . I have a Listview contains three text fields as a table data raw with a Link which onClick adds a raw to the List view ,and everything works fine except that the text fields gets cleared whenever I Press the add Link and a new raw added . here is my Html Mark up *HTML:* tr wicket:id=employersList tdinput type=text wicket:id=companyName //td tdinput type=text wicket:id=startDate //td tdinput type=text wicket:id=endDate //td /tr tr tda wicket:id=add href=#add/a/td /tr *J**ava code:* *public class CarPage extends WebPage {* * .. * * ...* * ** *private ListEmployer employerList =new ArrayListEmployer(); public CarPage() { ** ** ListView employersListView=getEmployersListView(); add(employersListView); Link addLink=new Link(add) {...@override public void onClick() { // TODO Auto-generated method stub employerList.add(new Employer()); } }; add(addLink); } private ListView getEmployersListView() { // TODO Auto-generated method stub ListView employersListView=new ListView(employersList,employerList) { @Override protected void populateItem(ListItem item) { // TODO Auto-generated method stub Employer employer=(Employer)item.getModelObject(); item.add(new TextFieldString(companyName,new PropertyModelString(employer, companyName))); item.add(new DateTextField(startDate, new PropertyModelDate(employer, startDate), new StyleDateConverter( S-, true)).add(new DatePicker())); item.add(new DateTextField(endDate, new PropertyModelDate(employer, endDate), new StyleDateConverter( S-, true)).add(new DatePicker())); } }; return employersListView; } * ...* *...* } class Employer implements Serializable{ String companyName; Date startDate, endDate; //Setters and getters } Thanks in advnce ... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Listview clears all the data in the textfileds after adding new element in the List
Hi Martin , thanks for your answer ,I add it the setReuseItems(true); but no effect , but the problem solved by changing the Link to submitLink and putting the Listview and the link in a form so by clicking the link all the fields in the form will be sent to the application.thanks to Sven for this solution . Thanks Martin , also for the reusemanager I didn't know this before , thanks again On Fri, Dec 25, 2009 at 2:56 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: ListView always popupates rows with new elements. That's why their state is cleared. You have two options: 1. call listview.setReuseItems - this will keep the old rows 2. if you need something more fancy and want to repopulate the rows, you will need to use a reusemanager that can copy the component states from the previous components: http://old.nabble.com/Check%28box%29-loses-checked-state-after-error-td26079574.html ** Martin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org