Re: Partial update of DataGridView when adding new items
Hi Chris, Please read https://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/ The article explains how to do this with ListView but the idea is the same for all other repeaters. On Wed, Dec 4, 2019 at 6:53 AM Chris Colman wrote: > We're using a DataGridView and we're happily doing partial updates of > existing items for select/deselect and when content changes. > > Updating existing items is fine because we can work out the changed Item > (Component) and just add it to the AJAX request target. > > However, we're wondering if it's possible to do partial updates of newly > added items? Currently for that we're adding the whole DataGridView to > the AJAX target but it causes a refresh which resets the current scroll > position so it's a bit annoying to the user. > > The trouble is we add new model items to the underlying collection that > the IDataProvider exposes but not sure how we work out which Item is > added for that and then how to tell it to update just that item in the UI. > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Partial
Hi, On Wed, Apr 24, 2019 at 8:14 PM Sibgha Nazir wrote: > I make the call like this > > @Override > > *public* *void* renderHead(IHeaderResponse response) > > { > > *super*.renderHead(response); > > > > Optional target = RequestCycle.*get* > ().find(AjaxRequestTarget.*class*); > > > *if* (!target.equals(Optional.*empty*())) > You can use target.isPresent() > > renderChart(target.get()); > > } > You are trying to update a component after the rendering process has been started. As the exception message tries to explain this is not allowed. Wicket request cycle is split in two phases - the action phase and the render phase. The action phase is when a callback method like onClick, onUpdate, onXyz is called. Here you can manipulate the component tree in any ways. Once the action phase is finished Wicket starts rendering - the complete page for non-Ajax requests or only the components added to AjaxRequestTarget for the Ajax ones. It works fine in the first request because it is a non-Ajax one and RequestCycle.find(AjaxRequestTarget) returns an empty Optional, so nothing is being done there. You need to move this code either to the action phase or to onConfigure() > > On Wed, Apr 24, 2019 at 7:00 PM Martin Grigorov > wrote: > > > Hi, > > > > On Wed, Apr 24, 2019 at 5:08 PM Sibgha Nazir > wrote: > > > > > Hello wicket developer, > > > > > > I am facing the following exception on re-rendering a wicket panel > using > > > the code > > > > > > > > > > > > iPartialPageRequestHandler.add(chartPanel); > > > > > > > In which method of your code do you make that call ? > > How do you get a reference to iPartialPageRequestHandler? Is it passed > as a > > parameter to the method by Wicket or do you look it up by using > > RequestCycle.find(Class) ? > > > > > > > > > > java.lang.IllegalStateException: A partial update of the page is being > > > rendered, component [ChartPanel [Component id = chart-container]] can > no > > > longer be added > > > > > > It renders it perfectly the first time. But I want to call this again > and > > > again when user clicks refresh button. What does this mean? > > > > > > Best Regards, > > > Sibgha Nazir > > > > > >
Re: Partial
I make the call like this @Override *public* *void* renderHead(IHeaderResponse response) { *super*.renderHead(response); Optional target = RequestCycle.*get* ().find(AjaxRequestTarget.*class*); *if* (!target.equals(Optional.*empty*())) renderChart(target.get()); } On Wed, Apr 24, 2019 at 7:00 PM Martin Grigorov wrote: > Hi, > > On Wed, Apr 24, 2019 at 5:08 PM Sibgha Nazir wrote: > > > Hello wicket developer, > > > > I am facing the following exception on re-rendering a wicket panel using > > the code > > > > > > > > iPartialPageRequestHandler.add(chartPanel); > > > > In which method of your code do you make that call ? > How do you get a reference to iPartialPageRequestHandler? Is it passed as a > parameter to the method by Wicket or do you look it up by using > RequestCycle.find(Class) ? > > > > > > java.lang.IllegalStateException: A partial update of the page is being > > rendered, component [ChartPanel [Component id = chart-container]] can no > > longer be added > > > > It renders it perfectly the first time. But I want to call this again and > > again when user clicks refresh button. What does this mean? > > > > Best Regards, > > Sibgha Nazir > > >
Re: Partial
In renderChart there is a line updating the chart panel like this PartialPageRequestHandler.add(chartPanel); On Wed, Apr 24, 2019 at 8:06 PM Sibgha Nazir wrote: > I make the call like this > > @Override > > *public* *void* renderHead(IHeaderResponse response) > > { > > *super*.renderHead(response); > > > > Optional target = RequestCycle.*get* > ().find(AjaxRequestTarget.*class*); > > > *if* (!target.equals(Optional.*empty*())) > > renderChart(target.get()); > > } > > On Wed, Apr 24, 2019 at 7:00 PM Martin Grigorov > wrote: > >> Hi, >> >> On Wed, Apr 24, 2019 at 5:08 PM Sibgha Nazir wrote: >> >> > Hello wicket developer, >> > >> > I am facing the following exception on re-rendering a wicket panel using >> > the code >> > >> > >> > >> > iPartialPageRequestHandler.add(chartPanel); >> > >> >> In which method of your code do you make that call ? >> How do you get a reference to iPartialPageRequestHandler? Is it passed as >> a >> parameter to the method by Wicket or do you look it up by using >> RequestCycle.find(Class) ? >> >> >> > >> > java.lang.IllegalStateException: A partial update of the page is being >> > rendered, component [ChartPanel [Component id = chart-container]] can no >> > longer be added >> > >> > It renders it perfectly the first time. But I want to call this again >> and >> > again when user clicks refresh button. What does this mean? >> > >> > Best Regards, >> > Sibgha Nazir >> > >> >
Re: Partial
Hi, On Wed, Apr 24, 2019 at 5:08 PM Sibgha Nazir wrote: > Hello wicket developer, > > I am facing the following exception on re-rendering a wicket panel using > the code > > > > iPartialPageRequestHandler.add(chartPanel); > In which method of your code do you make that call ? How do you get a reference to iPartialPageRequestHandler? Is it passed as a parameter to the method by Wicket or do you look it up by using RequestCycle.find(Class) ? > > java.lang.IllegalStateException: A partial update of the page is being > rendered, component [ChartPanel [Component id = chart-container]] can no > longer be added > > It renders it perfectly the first time. But I want to call this again and > again when user clicks refresh button. What does this mean? > > Best Regards, > Sibgha Nazir >
Re: partial Updating dataview with ajax
http://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/ -igor 2011/2/8 LePirlouit Benoît lepirlo...@hotmail.com: Hi All, I'm currently using an AbstractAjaxTimerBehavior witch refresh onTimer the dataview I want to append some components to my dataview . drax them on the page without refreshing all the others components that are allready on the page. eg in a realtime chat. you have only to load the new message in ajax without loading all the historical messages. in javascript I 'll do something like Append Before or Append After I don't know how to do this with wicket. also posted on : http://apache-wicket.1842946.n4.nabble.com/partial-Updating-dataview-with-ajax-td3275925.html Benoît de Biolley - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org