You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by LutherBaker <lu...@gmail.com> on 2010/10/13 07:20:05 UTC

AjaxRequestTarget not refreshing Component

I have created an outer list of areaGroups such that each group item contains
a list of areas. 

I am displaying a ModalWindow and editing an area. After changing the area's
name, I submit it via an AjaxSubmitButton which initially added the ListView
associated with a particular group. Obviously that failed (can't add a
repeater to an AjaxTargetRequest) at which point I added a
WebMarkupContainer to the markup. 

   	<dl wicket:id="group.list" class="groupList"> 
   	 <dt>[group name]</dt> 
   	 <wicket:container wicket:id="item.list.container"> 
   	 <dd wicket:id="item.list"> 
                        Edit    
   	 [item name]
   	 <div class="summary" wicket:id="item.summary">[item summary]</div> 
   	 </dd> 
   	 </wicket:container> 
   	</dl> 

I feed this inner ListView with a LodableDetachableModel where I
fetchAreasByAreaGroup: 

                @Override 
                protected List<Area> load() { 
                        return dataService.fetchAreasByAreaGroup(areaGroup); 
                } 

I also created a WebMarkupContainer in code and set its outputMarkupId: 

                final WebMarkupContainer itemListContainer = new
WebMarkupContainer("item.list.container"); 
                itemListContainer.setOutputMarkupId(true); 

I store the markup container in a hashmap keyed by AreaGroup which allows me
to, from the ModalWindow, retrieve the markup container associated with the
edited area's AreaGroup. Which I then add to the AjaxRequestTarget in the
ModalWindow's form's AjaxButton.onSubmit handler: 

                                        final WebMarkupContainer container =
areaPage.getWebMarkupContainer(area.getAreaGroup()); 
                                        target.addComponent(container); 

So all is well. It all compiles and the page loads without error. So, again,
I pop the ModalWindow up, change the name and put a breakpoint in the code.
I can see the AjaxRequestTarget add the container. I can see that the
container is not null. I can see the dataService retrieve the new area. I
can see the code execute which populates the inner ListView I mentioned
earlier - with the updated area properties. 

But, after the ModalWindow goes away, the underlying screen representation
doesn't change. The old name is still displayed. 

Here is a snippet of the generated markup where you can see
"item_list_container53" which identifies the wicket:container that I wish to
repaint. 

   	<dl wicket:id="group.list" class="groupList"> 
   	 <dt>Work</dt> 
   	 <wicket:container wicket:id="item.list.container"
id="item_list_container53"> 
   	 <dd wicket:id="item.list"> 
                        Edit    
   	 Hammerhead
   	 <div class="summary" wicket:id="item.summary">Day job learning large
scale infrastructure skills</div> 
   	 </dd> 
   	 </wicket:container> 
   	</dl><dl wicket:id="group.list" class="groupList"> 
   	 <dt>Business Ventures</dt> 
   	 <wicket:container wicket:id="item.list.container"
id="item_list_container55"> 
   	 <dd wicket:id="item.list"> 
                        Edit    
   	 Fuzzy Bearings
   	 <div class="summary" wicket:id="item.summary">Software Development
Effort</div> 
   	 </dd> 
   	 </wicket:container> 
   	</dl> 


Any thoughts on what I am missing? 

Thanks in advance, 
-Luther 

PS: Please note that nabble will not accept posts with 'onclick' text in the
code snippet 'a' tags ... so I specifically edited "onClick" to simply be
"click" in the code snippets.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-not-refreshing-Component-tp2993093p2993093.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: AjaxRequestTarget not refreshing Component

Posted by LutherBaker <lu...@gmail.com>.
Ah.

The update is running in the ModalWindow ... which is closing!

I've attached the ModalWindow's debug output below.

How do I, from the ModalWindow's submit button, get the underlying page
(which will soon be visible and have focus again) to receive the ajax
update?

Thanks,
-Luther



scroll lock | clear | close Wicket Ajax Debug Window (drag me here) 
INFO: focus set on name55
INFO: focus removed from name55
INFO: focus set on wicketDebugLink
INFO: focus removed from wicketDebugLink
INFO: focus set on submit_button58
INFO: Using ActiveX transport
INFO: 
INFO: Initiating Ajax POST request on
?wicket:interface=modal-dialog-pagemap:13:form:submit.button::IActivePageBehaviorListener:0:&wicket:ignoreIfNotActive=true&random=0.10684004615519632
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (1415 characters)
INFO: 
<?xml version="1.0" encoding="UTF-8"?><ajax-response><header-contribution
encoding="wicket1" ><![CDATA[<head
xmlns:wicket="http://wicket.apache.org"><script type="text/javascript"
src="resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"></script> 
<script type="text/javascript"
src="resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js"></script> 
<script type="text/javascript"
src="resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script> 
<script type="text/javascript"
id="wicket-ajax-debug-enable"><!--/*--><![CDATA[/*><!--*/
wicketAjaxDebugEnable=true;
/*-->]^]^>*/</script>

</head>]]></header-contribution><component id="item_list_container4c"
><![CDATA[ 
           <dd> 
             # Edit              
               
?wicket:interface=:12:group.panel:group.list:0:item.list.container:item.list:0:item.link::ILinkListener::
New Name Change  
               <div class="summary">Day job learning large scale
infrastructure skills</div> 
           </dd> 
           ]]></component></ajax-response>
INFO: Response parsed. Now invoking steps...
INFO: returned focused element: [object HTMLInputElement]
ERROR: Wicket.Ajax.Call.processComponent: Component with id
[[item_list_container4c]] a was not found while trying to perform markup
update. Make sure you called component.setOutputMarkupId(true) on the
component whose markup you are trying to update.
INFO: returned focused element: [object HTMLInputElement]
INFO: Response processed successfully.
INFO: Invoking post-call handler(s)...
INFO: refocus last focused component not needed/allowed
INFO: focus removed from submit_button58


-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-not-refreshing-Component-tp2993093p2994046.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: AjaxRequestTarget not refreshing Component

Posted by Jeremy Thomerson <je...@wickettraining.com>.
What does the Wicket AJAX debug window say in that response?

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

On Oct 13, 2010 12:20 AM, "LutherBaker" <lu...@gmail.com> wrote:


I have created an outer list of areaGroups such that each group item
contains
a list of areas.

I am displaying a ModalWindow and editing an area. After changing the area's
name, I submit it via an AjaxSubmitButton which initially added the ListView
associated with a particular group. Obviously that failed (can't add a
repeater to an AjaxTargetRequest) at which point I added a
WebMarkupContainer to the markup.

       <dl wicket:id="group.list" class="groupList">
        <dt>[group name]</dt>
        <wicket:container wicket:id="item.list.container">
        <dd wicket:id="item.list">
                       Edit
        [item name]
        <div class="summary" wicket:id="item.summary">[item summary]</div>
        </dd>
        </wicket:container>
       </dl>

I feed this inner ListView with a LodableDetachableModel where I
fetchAreasByAreaGroup:

               @Override
               protected List<Area> load() {
                       return dataService.fetchAreasByAreaGroup(areaGroup);
               }

I also created a WebMarkupContainer in code and set its outputMarkupId:

               final WebMarkupContainer itemListContainer = new
WebMarkupContainer("item.list.container");
               itemListContainer.setOutputMarkupId(true);

I store the markup container in a hashmap keyed by AreaGroup which allows me
to, from the ModalWindow, retrieve the markup container associated with the
edited area's AreaGroup. Which I then add to the AjaxRequestTarget in the
ModalWindow's form's AjaxButton.onSubmit handler:

                                       final WebMarkupContainer container =
areaPage.getWebMarkupContainer(area.getAreaGroup());
                                       target.addComponent(container);

So all is well. It all compiles and the page loads without error. So, again,
I pop the ModalWindow up, change the name and put a breakpoint in the code.
I can see the AjaxRequestTarget add the container. I can see that the
container is not null. I can see the dataService retrieve the new area. I
can see the code execute which populates the inner ListView I mentioned
earlier - with the updated area properties.

But, after the ModalWindow goes away, the underlying screen representation
doesn't change. The old name is still displayed.

Here is a snippet of the generated markup where you can see
"item_list_container53" which identifies the wicket:container that I wish to
repaint.

       <dl wicket:id="group.list" class="groupList">
        <dt>Work</dt>
        <wicket:container wicket:id="item.list.container"
id="item_list_container53">
        <dd wicket:id="item.list">
                       Edit
        Hammerhead
        <div class="summary" wicket:id="item.summary">Day job learning large
scale infrastructure skills</div>
        </dd>
        </wicket:container>
       </dl><dl wicket:id="group.list" class="groupList">
        <dt>Business Ventures</dt>
        <wicket:container wicket:id="item.list.container"
id="item_list_container55">
        <dd wicket:id="item.list">
                       Edit
        Fuzzy Bearings
        <div class="summary" wicket:id="item.summary">Software Development
Effort</div>
        </dd>
        </wicket:container>
       </dl>


Any thoughts on what I am missing?

Thanks in advance,
-Luther

PS: Please note that nabble will not accept posts with 'onclick' text in the
code snippet 'a' tags ... so I specifically edited "onClick" to simply be
"click" in the code snippets.
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-not-refreshing-Component-tp2993093p2993093.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