igor,

I am already setting it . Do i have to provide any custom implementation?

refreshingView.setItemReuseStrategy(new ReuseIfModelsEqualStrategy());

-krishna



igor.vaynberg wrote:
> 
> see IItemReuseStrategy
> 
> -igor
> 
> On Fri, Sep 26, 2008 at 8:41 AM, krisnv <[EMAIL PROTECTED]> wrote:
>>
>> <p>Thanks for you reply and pointing to the right component to use. Just
>> curious, is there any way to fix this to make it work using this
>> approach?</p>
>>
>> <p>krishna</p>
>>
>>
>> Matej Knopp-2 wrote:
>>>
>>> That's probably because refreshing view is creating new components on
>>> every request. Try using listView nad don't forget to call
>>> setReuseItems(true) on it.
>>>
>>> -Matej
>>>
>>> On Fri, Sep 26, 2008 at 4:49 PM, krisnv <[EMAIL PROTECTED]> wrote:
>>>>
>>>> can any of you please respond.
>>>>
>>>>
>>>> krisnv wrote:
>>>>>
>>>>> <p>I have RefreshingView similar to Contact Editor in Wicket
>>>>> Examples.<BR>
>>>>>  I added a Panel and TextFields to this RefreshingView. <BR>I populate
>>>>> these TextFields from a list from Database and have assigned Model
>>>>> objects
>>>>> to each TextField component. The problem is when user modifies a value
>>>>> in
>>>>> any of the text fields, i still get old value from the original list.
>>>>> Model is not getting updated to reflect new value entered by the use.
>>>>> Here
>>>>> is the code:</p>
>>>>> <p>
>>>>> RefreshingView refreshingView = new RefreshingView("simple") { <BR>
>>>>> protected Iterator getItemModels() {<BR>  return new
>>>>> ModelIteratorAdapter(users)<BR> { <BR>protected IModel model(Object
>>>>> object) {<BR> return new DetachableUserModel((User)object); <BR>}<BR>
>>>>> };
>>>>> <BR>}<BR> protected void populateItem(final Item item) { <BR>//
>>>>> populate
>>>>> the row of the repeater<BR> IModel user = item.getModel();
>>>>> <BR>item.add(new ActionPanel("actions",
>>>>> item.getModel()).setOutputMarkupId(true));<BR> item.add(new
>>>>> TextField("UserName", new AbstractReadOnlyModel() <BR>{ <BR>public
>>>>> Object
>>>>> getObject() <BR>{<BR> User ur = (User)item.getModelObject(); return
>>>>> ur.getUserName();<BR> }<BR> }<BR>));<BR> item.add(new
>>>>> TextField("FirstName", new AbstractReadOnlyModel()<BR> { <BR>public
>>>>> Object
>>>>> getObject()<BR> {<BR> User ur = (User)item.getModelObject();
>>>>> <BR>return
>>>>> ur.getFirstName();<BR> } <BR>}<BR>));<BR> item.add(new
>>>>> TextField("LastName", new AbstractReadOnlyModel() { <BR>public Object
>>>>> getObject() {<BR> User ur = (User)item.getModelObject();<BR> return
>>>>> ur.getLastName(); } <BR>}<BR>));<BR> item.add(new
>>>>> TextField("ContactPhone", new AbstractReadOnlyModel() { <BR>public
>>>>> Object
>>>>> getObject() <BR>{ <BR>User ur = (User)item.getModelObject();<BR>
>>>>> return
>>>>> ur.getPhone(); }<BR> }<BR>)); <BR>item.add(new TextField("Email", new
>>>>> AbstractReadOnlyModel()<BR> {<BR> public Object getObject()<BR>
>>>>> {<BR>   User ur = (User)item.getModelObject();
>>>>> <BR>  return ur.getEmail();<BR> } <BR>}<BR>)<BR>);
>>>>> <BR>item.add(new PasswordTextField("Password", new
>>>>> AbstractReadOnlyModel()
>>>>> {<BR> public Object getObject() <BR>{ <BR>    User ur =
>>>>> (User)item.getModelObject(); <BR>  return ur.getPassword(); <BR>}
>>>>> <BR>}<BR>)); <BR>}<BR> protected Item newItem(String id, int index,
>>>>> IModel
>>>>> model) <BR>{<BR> // this item sets markup class attribute to either
>>>>> 'odd'
>>>>> or<BR> // 'even' for decoration return new OddEvenItem(id, index,
>>>>> model);
>>>>> <BR>}<BR> }; <BR>refreshingView.setOutputMarkupId(true);
>>>>> <BR>refreshingView.setItemReuseStrategy(new
>>>>> ReuseIfModelsEqualStrategy());
>>>>> <BR>refreshingView.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
>>>>> <BR>form.add(refreshingView); }</p>
>>>>> <p>
>>>>> Here is the code for the Panel. I am trying to print the value from
>>>>> the
>>>>> text field but still getting old value.<BR> private class ActionPanel
>>>>> extends Panel
>>>>> </p><p>{ <BR> public ActionPanel(String id, IModel model) <BR>{
>>>>> <BR>super(id, model); <BR> add(new Link("edit") {<BR> public void
>>>>> onClick() {<BR> int resultCode=0; <BR>User usr =
>>>>> (User)getParent().getModelObject();
>>>>> <BR>System.out.println("firstname=="+usr.getFirstName()); <BR> }
>>>>> <BR>}<BR>);<BR> }
>>>>> </p><p>Any help would be appreciated. Thanks, krishna</p>
> 
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Model-object-not-geeting-updated-inside-a-RefreshingView-tp19688544p19689965.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]
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Model-object-not-geeting-updated-inside-a-RefreshingView-tp19688544p19691024.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]
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Model-object-not-geeting-updated-inside-a-RefreshingView-tp19688544p19691306.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