Re: Ajax-Panel Toggling Visibility

2010-08-10 Thread Nivedan Nadaraj
Hi

The List View is being refreshed now. I have made couple of iterations and
have pretty much lost track of how I went about. But, one of the things I
did was
add an anonymous class in my Search panel as ar LoadableDetachableModel and
in the load() I return a list from the CompoundPropertyModel instance that I
created as part of the Search form instance.

I guess this(LoadableDetachableModel)  was a requirement if we want the
search results panel to be repainted with 'new' data from model i.e update
the model the ListView uses?

I have a slightly different behavior now,  which is correct logically
speaking  but I think i should start a different thread.Also if is allowed
to upload a sample project for the experts to comment on the approach taken
and also thought it I can contribute it after some modification as a
tutorial or guide for newbies like me?

Your thoughts as always appreciate

Cheers


On Mon, Aug 9, 2010 at 11:24 AM, Nivedan Nadaraj shravann...@gmail.comwrote:

 Hi
 Thanks for the pointers.

 I have tried doing the following and yet to see the expected result (i.e
 re-render the list view with the new items)

 1 .Using an entirely new Model instance, and seting it using setModel
 2. When the Listview is created I have said setReuseItems(true)
 3. When the model has changed I execute the listview.removeAll() (prior to
 updating the model)// as per documentation  removeAll is to be called if
 model changed
 4. Since we say setModel() wouldn't that call modelChanged()? Anyways I
 have expliclty invoked modelChanged

 Bascially, I have got the ListView inside a panel.The panel is wrapped
 inside the WebmarkupContainer.

 thanks again
 Niv



 On Fri, Aug 6, 2010 at 6:57 PM, Wilhelmsen Tor Iver toriv...@arrive.nowrote:

  this.setModelObject(updatedModelInstance);

 Are you sure you do not mean setModel() instead of setModelObject() here?

 Also, look into whether you use setReuseItems(true) on the listview, then
 you probably want modelChanged() somewhere too.

 - Tor Iver

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





Re: Ajax-Panel Toggling Visibility

2010-08-08 Thread Nivedan Nadaraj
Hi
Thanks for the pointers.

I have tried doing the following and yet to see the expected result (i.e
re-render the list view with the new items)

1 .Using an entirely new Model instance, and seting it using setModel
2. When the Listview is created I have said setReuseItems(true)
3. When the model has changed I execute the listview.removeAll() (prior to
updating the model)// as per documentation  removeAll is to be called if
model changed
4. Since we say setModel() wouldn't that call modelChanged()? Anyways I have
expliclty invoked modelChanged

Bascially, I have got the ListView inside a panel.The panel is wrapped
inside the WebmarkupContainer.

thanks again
Niv


On Fri, Aug 6, 2010 at 6:57 PM, Wilhelmsen Tor Iver toriv...@arrive.nowrote:

  this.setModelObject(updatedModelInstance);

 Are you sure you do not mean setModel() instead of setModelObject() here?

 Also, look into whether you use setReuseItems(true) on the listview, then
 you probably want modelChanged() somewhere too.

 - Tor Iver

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Ajax-Panel Toggling Visibility

2010-08-06 Thread Niv

Hi 

I got an issue with making a panel visible via Ajax. I had a look at the
following link to refer and I seemed to have done all that was mentioned out
there.

http://apache-wicket.1842946.n4.nabble.com/Panel-setVisible-in-Ajax-call-td1861998.html#a1861998



When i first create the panel, I set it like this

searchResults.setOutputMarkupPlaceholderTag(true);
searchResults.setVisible(false);

Then when user clicked the Ajax button/link

I compute the resultList that must be updated on the searchResults and then
do the following:

onSearch(AjaxRequestTarget target){
  searchResults = new SearchResults(id,list); //- Not sure if this is the
correct way to refresh a ListView...
  searchResults.setOutputMarkupPlaceholderTag(true);
  searchResults.setVisible(true); // - Setting it to true
  target.addComponent(searchResults);
}

There is no exception being thrown. On the Ajax debug window I get the
following.I don't see the markup being refreshed.

INFO: focus removed from 
INFO: focus set on test11
INFO:
INFO: Initiating Ajax GET request on
?wicket:interface=:4:searchPanel:searchForm:test::IBehaviorListener:0:random=0.6959895812032867
INFO: Invoking pre-call handler(s)...
INFO: focus removed from test11
INFO: Received ajax response (69 characters)
INFO:
?xml version=1.0 encoding=UTF-8?ajax-response/ajax-response
INFO: Response parsed. Now invoking steps...
INFO: Response processed successfully.
INFO: Invoking post-call handler(s)...
INFO: refocus last focused component not needed/allowed
INFO: focus set on test11
INFO: focus removed from test11


Any thoughts?

Thank
Niv

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajax-Panel-Toggling-Visibility-tp2316018p2316018.html
Sent from the Wicket - User 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: Ajax-Panel Toggling Visibility

2010-08-06 Thread Niv

Hi

 I think I failed to explicitly mention that the panel is not being made
visible even though the code to setVisible is executed.

Thanks
niv
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajax-Panel-Toggling-Visibility-tp2316018p2316020.html
Sent from the Wicket - User 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: Ajax-Panel Toggling Visibility

2010-08-06 Thread Wilhelmsen Tor Iver
   searchResults = new SearchResults(id,list); //- Not sure if this
 is the
 correct way to refresh a ListView...

It's not. Creating a new object like this will defeat the logic because it has 
not been added to the hierarchy that the Ajax call expects.

What you want to do is to modify the *model* of the result, then tell it to 
repaint. For repeaters (like ListView) where the markup is used multiple times 
and the real wicket id is something completely different than what you may 
think, you also want to put a wrapper in the form of a WebMarkupContainer 
around the repeater and then use that for visibility and Ajax updates.

- Tor Iver

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Ajax-Panel Toggling Visibility

2010-08-06 Thread Nivedan Nadaraj
Hi

Thank's for correcting me on how to update the ListView, nicely explained.


1. I am able to view the results panel now.

2. I have made change in the following way to update the list by updating
the model.

Added a WebMarkupContainer and wrapped the ListView within it.
The visibility is applied now only on the WebMarkupContainer that wraps the
list.


So now, I update the model and call
this.setModelObject(updatedModelInstance);,

But now I can see only the header of the Listiview being rendered and the
actual data/repeated items are blank... is not re-painted. The markup on the
ajax response has the following:


*INFO: *Received ajax response (723 characters)
*INFO: *
?xml version=1.0 encoding=UTF-8?ajax-responsecomponent
id=resultListContainer13 ![CDATA[div id=resultListContainer13

div
table width=0% cellspacing=0/table
table width=100% cellspacing=0 class=dataview
tr
th width=5%nbsp;/th
th width=15%First Name/th

th width=5%nbsp;/th
th width=15%label for=MiddleNameMiddle Name/label/th

th width=5%nbsp;/th
th width=15%label for=LastNameLast Name/label/th

th width=5%nbsp;/th
th width=15%nbsp;
/th
/tr

The content is not rendered, now why would that happen? Does it need to
invoke a method on the result list panel to render the contents? Now am
thinking should i add a wrapper WebMarkupContainer for the PageableListView
as well? So Ajax can re-paint it?

Thanks for the time,

Reg
Niv


On Fri, Aug 6, 2010 at 4:14 PM, Wilhelmsen Tor Iver toriv...@arrive.nowrote:

searchResults = new SearchResults(id,list); //- Not sure if this
  is the
  correct way to refresh a ListView...

 It's not. Creating a new object like this will defeat the logic because it
 has not been added to the hierarchy that the Ajax call expects.

 What you want to do is to modify the *model* of the result, then tell it to
 repaint. For repeaters (like ListView) where the markup is used multiple
 times and the real wicket id is something completely different than what
 you may think, you also want to put a wrapper in the form of a
 WebMarkupContainer around the repeater and then use that for visibility and
 Ajax updates.

 - Tor Iver

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Ajax-Panel Toggling Visibility

2010-08-06 Thread Nivedan Nadaraj
I initalised the ListView with some data and now when i click the search
ajax button it renders the header and content that the list was first at the
time of construction initialised with.
However, as part of onSearch click i do update the list and set the model.
This new data is not being rendered.

Could it be a model issue?
Could it be to do with something extra to take care of updating the
repeatable list. I also looked at the following link

 https://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html

I have followed pretty much everything necessary for wrapping the list
control and hide and unhide. The only this is I do not use the

AjaxSelfUpdatingTimerBehavior and LoadableDetachableModel. I don't
think this is causing the issue.


Any thoughts to help?

Cheers
Niv



On Fri, Aug 6, 2010 at 5:12 PM, Nivedan Nadaraj shravann...@gmail.comwrote:

 Hi

 Thank's for correcting me on how to update the ListView, nicely explained.


 1. I am able to view the results panel now.

 2. I have made change in the following way to update the list by updating
 the model.

 Added a WebMarkupContainer and wrapped the ListView within it.
 The visibility is applied now only on the WebMarkupContainer that wraps the
 list.


 So now, I update the model and call
 this.setModelObject(updatedModelInstance);,

 But now I can see only the header of the Listiview being rendered and the
 actual data/repeated items are blank... is not re-painted. The markup on the
 ajax response has the following:


 *INFO: *Received ajax response (723 characters)
 *INFO: *
 ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent 
 id=resultListContainer13 ![CDATA[div id=resultListContainer13

 div
 table width=0% cellspacing=0/table
 table width=100% cellspacing=0 class=dataview
 tr
 th width=5%nbsp;/th
 th width=15%First Name/th

 th width=5%nbsp;/th

 th width=15%label for=MiddleNameMiddle Name/label/th

 th width=5%nbsp;/th
 th width=15%label for=LastNameLast Name/label/th

 th width=5%nbsp;/th
 th width=15%nbsp;
 /th
 /tr

 The content is not rendered, now why would that happen? Does it need to
 invoke a method on the result list panel to render the contents? Now am
 thinking should i add a wrapper WebMarkupContainer for the PageableListView
 as well? So Ajax can re-paint it?

 Thanks for the time,

 Reg
 Niv



 On Fri, Aug 6, 2010 at 4:14 PM, Wilhelmsen Tor Iver toriv...@arrive.nowrote:

searchResults = new SearchResults(id,list); //- Not sure if this
  is the
  correct way to refresh a ListView...

 It's not. Creating a new object like this will defeat the logic because it
 has not been added to the hierarchy that the Ajax call expects.

 What you want to do is to modify the *model* of the result, then tell it
 to repaint. For repeaters (like ListView) where the markup is used multiple
 times and the real wicket id is something completely different than what
 you may think, you also want to put a wrapper in the form of a
 WebMarkupContainer around the repeater and then use that for visibility and
 Ajax updates.

 - Tor Iver

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





SV: Ajax-Panel Toggling Visibility

2010-08-06 Thread Wilhelmsen Tor Iver
 this.setModelObject(updatedModelInstance);

Are you sure you do not mean setModel() instead of setModelObject() here?

Also, look into whether you use setReuseItems(true) on the listview, then you 
probably want modelChanged() somewhere too.

- Tor Iver

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org