Re: Components do not re-render when page is refreshed...
Ok..thanks for helping me out Dan...:) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650311.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: Components do not re-render when page is refreshed...
DataView/IDataProvider queries the database for each request too. The reason it is preferred over PageableListView is that it allows only the current page of results to be pulled from the database. PageableListView requires *all* results to be pulled, but then only renders a single page. At any rate, using an IModel-backed PageableListView will look something like this: IModel> itemsModel = new LoadableDetachableModel>() { protected List load() { // query database for items } }; add(new PageableListView("item", itemsModel, 10) { protected void populateItem(ListItem item) { // populate item } }); On Sat, Jun 30, 2012 at 1:20 AM, kshitiz wrote: > Actually I am using listview because I do want to query database every > time I > change page of pageable listview. How would I use IModel in > pageableListview? > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650303.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: Components do not re-render when page is refreshed...
Actually I am using listview because I do want to query database every time I change page of pageable listview. How would I use IModel in pageableListview? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650303.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: Components do not re-render when page is refreshed...
I can't guess what your errors are, but for pageable lists you should probably be using DataView. There are examples here: http://www.wicket-library.com/wicket-examples/repeater/ On Fri, Jun 29, 2012 at 1:08 PM, kshitiz wrote: > I am using list only like this: > > > PageableListView postDomainListView = new > PageableListView( >"postList", *postDomainList*, postsPerPage) > { > // . > > } > > How am I suppose to use IModel for list? It is giving errors over here... > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650299.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: Components do not re-render when page is refreshed...
I am using list only like this: PageableListView postDomainListView = new PageableListView( "postList", *postDomainList*, postsPerPage) { // . } How am I suppose to use IModel for list? It is giving errors over here... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650299.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: Components do not re-render when page is refreshed...
Are you giving your ListView an IModel> or a List? It needs to be the former to be redetermined on refresh. On Fri, Jun 29, 2012 at 12:48 PM, kshitiz wrote: > Actually in that post panel, I am taking data from the database and > displaying it as listview. Now, when I manually enter a new entry in the > database and then refresh page, the new entry is not getting displayed. > This > simple means that the given panel is not picking up the data from the > database at every refresh or in other words, methods are not being called > of > that panel. > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650297.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: Components do not re-render when page is refreshed...
Actually in that post panel, I am taking data from the database and displaying it as listview. Now, when I manually enter a new entry in the database and then refresh page, the new entry is not getting displayed. This simple means that the given panel is not picking up the data from the database at every refresh or in other words, methods are not being called of that panel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650297.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: Components do not re-render when page is refreshed...
Instead of using entities and strings in your constructors, use IModels such as LoadableDetachableModel. When re-rendering (AJAX or reload), your constructors aren't called again, but IModel#getObject() are called. On Fri, Jun 29, 2012 at 12:09 PM, kshitiz wrote: > Hi, > > Thanks for the reply. Just to clarify, like if I am adding a panel: > > *add(new PostPanel("postPanel", pageParameters, userTypeDomain, >userDomain));* > > So, how do I make it render at every page refresh...? > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650294.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: Components do not re-render when page is refreshed...
It is rendered, but the existing page is reused so you do not see the constructor called again. That's what Dan meant when he said, "That's how Wicket manages stateful pages: it constructs it once, and subsequent actions (including re-rendering all or part) are handled by the same instance." You could override beforeRender() and/or afterRender() and add logging there if you want to verify that rendering occurs. That said, it's clear that you have some problem because you say that "nothing happens" when the page is refreshed. So what you expect to happen? What change do you not see? Scott On Fri, Jun 29, 2012 at 12:09 PM, kshitiz wrote: > Hi, > > Thanks for the reply. Just to clarify, like if I am adding a panel: > > *add(new PostPanel("postPanel", pageParameters, userTypeDomain, > userDomain));* > > So, how do I make it render at every page refresh...? > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650294.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: Components do not re-render when page is refreshed...
Hi, Thanks for the reply. Just to clarify, like if I am adding a panel: *add(new PostPanel("postPanel", pageParameters, userTypeDomain, userDomain));* So, how do I make it render at every page refresh...? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650294.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: Components do not re-render when page is refreshed...
That's how Wicket manages stateful pages: it constructs it once, and subsequent actions (including re-rendering all or part) are handled by the same instance. If you want a label's content to be recomputed with each rendering, give it an IModel at construction instead of the actual string. On Fri, Jun 29, 2012 at 10:50 AM, kshitiz wrote: > Hi, > > Like this is one page: > > > public UserHome(final PageParameters pageParameters, UserDomain userDomain) > { > super(pageParameters, userDomain); >if (userDomain == null) >userDomain = getUserById(this.userId); > >add(new SearchPanel("searchPanel")); > >// user name to appear in required pages >* Label nameLabel = new Label("name", userDomain.getName()); >add(nameLabel); > * > *system.out.println("This should be printed every time");* > > } > > Now, when the page loads the first time, *This should be printed every > time* > is printed. That means, contructor is called. But when the page is > refreshed, nothing is printed. To give you more details, suppose this is > the > url of the page: > > /http://localhost:8080/Page?32/ > > When, I just refresh the whole url, nothings happens but when I remove > parameters of the url(/http://localhost:8080/Page/, rendering happens > again. Why is this happening? > > > > scott.swank wrote > > > > How do you construct your panels? This sounds like a model issue... > > > > Scott > > > > On Fri, Jun 29, 2012 at 9:02 AM, kshitiz <k.agarwal4@> wrote: > >> Hi, > >> > >> In my wicket application, each page carries many panels. *Now every > panel > >> is > >> rendered when the page is loaded but when it is refreshed, nothing > >> happens. > >> * No panel is getting rendered again, not even sysouts are printing > >> anything. *Now this is a good thing for performance but I want them to > be > >> re-rendered.Is there any way to make it happen...??* > >> > >> -- > >> View this message in context: > >> > http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290.html > >> Sent from the Users forum mailing list archive at Nabble.com. > >> > >> - > >> To unsubscribe, e-mail: users-unsubscribe@.apache > >> For additional commands, e-mail: users-help@.apache > >> > > > > - > > To unsubscribe, e-mail: users-unsubscribe@.apache > > For additional commands, e-mail: users-help@.apache > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650292.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: Components do not re-render when page is refreshed...
Hi, Like this is one page: public UserHome(final PageParameters pageParameters, UserDomain userDomain) { super(pageParameters, userDomain); if (userDomain == null) userDomain = getUserById(this.userId); add(new SearchPanel("searchPanel")); // user name to appear in required pages * Label nameLabel = new Label("name", userDomain.getName()); add(nameLabel); * *system.out.println("This should be printed every time");* } Now, when the page loads the first time, *This should be printed every time* is printed. That means, contructor is called. But when the page is refreshed, nothing is printed. To give you more details, suppose this is the url of the page: /http://localhost:8080/Page?32/ When, I just refresh the whole url, nothings happens but when I remove parameters of the url(/http://localhost:8080/Page/, rendering happens again. Why is this happening? scott.swank wrote > > How do you construct your panels? This sounds like a model issue... > > Scott > > On Fri, Jun 29, 2012 at 9:02 AM, kshitiz <k.agarwal4@> wrote: >> Hi, >> >> In my wicket application, each page carries many panels. *Now every panel >> is >> rendered when the page is loaded but when it is refreshed, nothing >> happens. >> * No panel is getting rendered again, not even sysouts are printing >> anything. *Now this is a good thing for performance but I want them to be >> re-rendered.Is there any way to make it happen...??* >> >> -- >> View this message in context: >> http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290.html >> Sent from the Users forum mailing list archive at Nabble.com. >> >> - >> To unsubscribe, e-mail: users-unsubscribe@.apache >> For additional commands, e-mail: users-help@.apache >> > > - > To unsubscribe, e-mail: users-unsubscribe@.apache > For additional commands, e-mail: users-help@.apache > -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650292.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: Components do not re-render when page is refreshed...
How do you construct your panels? This sounds like a model issue... Scott On Fri, Jun 29, 2012 at 9:02 AM, kshitiz wrote: > Hi, > > In my wicket application, each page carries many panels. *Now every panel is > rendered when the page is loaded but when it is refreshed, nothing happens. > * No panel is getting rendered again, not even sysouts are printing > anything. *Now this is a good thing for performance but I want them to be > re-rendered.Is there any way to make it happen...??* > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290.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
Components do not re-render when page is refreshed...
Hi, In my wicket application, each page carries many panels. *Now every panel is rendered when the page is loaded but when it is refreshed, nothing happens. * No panel is getting rendered again, not even sysouts are printing anything. *Now this is a good thing for performance but I want them to be re-rendered.Is there any way to make it happen...??* -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290.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