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
                               List<Tab>  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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to