You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jchappelle <jc...@4redi.com> on 2014/03/03 17:25:30 UTC

Re: View page not updating after Edit page makes changes

On your View page your ListView should have a LoadableDetachableModel passed
to it instead of the Article.getArticles() list. In fact you could use the
same model that you have feeding your DropDownChoice in your edit page. Just
refactor that model out into a separate class and use in both cases.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/View-page-not-updating-after-Edit-page-makes-changes-tp4664739p4664745.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: View page not updating after Edit page makes changes

Posted by jchappelle <jc...@4redi.com>.
I tried using your code with wicket 6 and it wasn't working so I'm guessing
you are using something earlier than wicket 6. ByteImageResource could not
be resolved. 

I did make a change to the Article class and the TestView class that seemed
to make it work. I changed Article to have a url String instead of storing
the byte array of the image. I think that is better from a design standpoint
as well. But I'll try not to muddy the waters with my design
recommendations. Once I did that I changed the TestView to display the image
like this:

item.add(new Image("thumbImg", new
UrlResourceReference(Url.parse(item.getModelObject().getUrl()))));

Once I did that it seemed to work. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/View-page-not-updating-after-Edit-page-makes-changes-tp4664739p4664758.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: View page not updating after Edit page makes changes

Posted by lytrean <wi...@nicdelorme.com>.
Article class: http://pastebin.com/pNy8FUJQ
Article instantiation in WebApplication constructor:
http://pastebin.com/j92mF3Fs
ByteImageResource class: http://pastebin.com/G4rC3DgG


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/View-page-not-updating-after-Edit-page-makes-changes-tp4664739p4664753.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: View page not updating after Edit page makes changes

Posted by jchappelle <jc...@4redi.com>.
I took your code and I could reproduce it but then I realized that my
Article.getArticles() method was returning a new ArrayList every time it was
called. I changed it to be static and it fixed it. I did omit the
article.getSmallThumbImageResource() method though.

Can you post the code for your Article class please? 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/View-page-not-updating-after-Edit-page-makes-changes-tp4664739p4664751.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: View page not updating after Edit page makes changes

Posted by lytrean <wi...@nicdelorme.com>.
Thanks for your reply!  This change got me part of the way there.  The
behavior is like this now:

1) Select second item from drop-down (edit fields auto-populate with correct
data)
2) Edit description and submit
3) Display view in second tab -- view displays updated description correctly
4) Switch back to edit tab
5) Modify description again (without clicking on drop-down because it
already has correct item selected) and submit.  Note: after the page
refreshes from the submit the drop-down defaults back to the first item in
the drop-down instead of the one that was selected.  I suspect my session or
something has lost which Article it should be updating.
6) Switch back to view tab and refresh -- description does NOT update
7) Switch back to the edit tab and change drop-down to the second item. 
Indeed, the description was NOT updated -- it did not save from step 5

Updated code (note: there is duplicate code that could be re-factored --
just wanted to keep the change simple):
Edit Page: http://pastebin.com/qk4jGNrv
View Page: http://pastebin.com/a4DyWwSm

Thanks for your help!!!



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/View-page-not-updating-after-Edit-page-makes-changes-tp4664739p4664746.html
Sent from the Users forum mailing list archive at Nabble.com.

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