You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Adz <ad...@three.com.au> on 2010/10/27 10:04:13 UTC

Updating inmethod grid from the server

Hi,

I have a requirement whereby I need to periodically poll the db, and refresh
my in method grid if anything has changed.  I've started out by just trying
to get the whole grid to refresh, but I can't seem to get it to work.  I'm
creating my DefaultDataGrid with an implementation of the IDataSource

final DefaultDataGrid tradeDataTable = new DefaultDataGrid("trades",
tradeDataSource, getColumns());

When my onTimer event occurs I go back to the DB, pull out my data and set
it in the tradeDataSource.  I can see that the query method is getting
called again, and it is returning the correct new data, but the grid is not
updating.  I've tried adding combinations of the below, to no avail. 

tradeDataTable.markAllItemsDirty();
tradeDataTable.update();
tradeDataTable.renderComponent();

Does anyone know what i'm doing wrong, or if there is a good example for
using ajax from the server to refresh a DefaultDataGrid.

All help is much appreciated

Adam
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-inmethod-grid-from-the-server-tp3015007p3015007.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: Updating inmethod grid from the server

Posted by Adz <ad...@three.com.au>.
Ah yes, it occurred to me last night that my implementation of equals for my
object must be the problem, thanks for the help.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-inmethod-grid-from-the-server-tp3015007p3018162.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: Updating inmethod grid from the server

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Wed, Oct 27, 2010 at 7:00 PM, Adz <ad...@three.com.au> wrote:

>
> I tried that, it didn't make any difference.  I think the problem is due to
> the item reuse strategy ReuseIfModelsEqualStrategy.  It has a cache of the
> existing items and only compares to see if the new models are in the list
> of
> the old models (which for my case they are), and if they are it uses the
> old
> model, regardless of whether the data in the new model is different.
>

Okay, then I believe your problem is one of the following two things:

   1. the objects that your model contains (likely your domain objects) do
   not implement equals and/or hashcode properly
   2. when you created the things in your row items, you didn't use models
   properly, so they have old, stale data in them

Posting code is the only way to get more help.

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*

Re: Updating inmethod grid from the server

Posted by Adz <ad...@three.com.au>.
I tried that, it didn't make any difference.  I think the problem is due to
the item reuse strategy ReuseIfModelsEqualStrategy.  It has a cache of the
existing items and only compares to see if the new models are in the list of
the old models (which for my case they are), and if they are it uses the old
model, regardless of whether the data in the new model is different.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-inmethod-grid-from-the-server-tp3015007p3016451.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: Updating inmethod grid from the server

Posted by Jeremy Thomerson <je...@wickettraining.com>.
All you should need to do in your timer method is target.add(table). That
will handle re-rendering it, which also means pulling the fresh data in from
your data provider.

Jeremy Thomerson
http://wickettraining.com
-- sent from my "smart" phone, so please excuse spelling, formatting, or
compiler errors

On Oct 27, 2010 3:04 AM, "Adz" <ad...@three.com.au> wrote:


Hi,

I have a requirement whereby I need to periodically poll the db, and refresh
my in method grid if anything has changed.  I've started out by just trying
to get the whole grid to refresh, but I can't seem to get it to work.  I'm
creating my DefaultDataGrid with an implementation of the IDataSource

final DefaultDataGrid tradeDataTable = new DefaultDataGrid("trades",
tradeDataSource, getColumns());

When my onTimer event occurs I go back to the DB, pull out my data and set
it in the tradeDataSource.  I can see that the query method is getting
called again, and it is returning the correct new data, but the grid is not
updating.  I've tried adding combinations of the below, to no avail.

tradeDataTable.markAllItemsDirty();
tradeDataTable.update();
tradeDataTable.renderComponent();

Does anyone know what i'm doing wrong, or if there is a good example for
using ajax from the server to refresh a DefaultDataGrid.

All help is much appreciated

Adam
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Updating-inmethod-grid-from-the-server-tp3015007p3015007.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