Results 1 to 6 of 6

Thread: aja: fragment not updating

Hybrid View

  1. #1
    Join Date
    Jan 2010
    Posts
    19

    Default ajax: fragment not updating

    Hi,

    I am stuck with ajax and fragment rendering.

    I am new to both, spring and webflow, and try to do some ajax stuff. Ic ould not get the fragment to rerender so I stripped my code to a minimum.

    have a bean with a "testNumber", an increaseTestNumber Method and a ui:fragment on my xhtml which only shows this number.

    flow:
    Code:
    		<transition on="changeAddress">			
    			<evaluate expression="card.owner.address.incNumber()" />
    			<render fragments="testFragmentXYZ" />			
    		</transition>
    xhtml fragment:
    Code:
    					    <ui:fragment id="testFragmentXYZ">
    					    		#{card.owner.address.currentNumber}
    					    </ui:fragment>
    xhtml-action button
    Code:
    <sf:commandLink action="addressLookup" processIds="*" >

    when i click the button, the "testNumber" gets increased correctly, means that the ajax call is succesful. the fragment does not seem to be rendered/updated. when i hit f5 and reload the entire page, the updated number is shown.

    what am I doing wrong?
    Last edited by Mulder_; Feb 15th, 2010 at 09:27 AM.

  2. #2
    Join Date
    Oct 2008
    Location
    Warsaw, Poland
    Posts
    124

    Wink

    I'm not sure but you might need to use form or panel instead of fragment. It works in my case.

    Code:
    <h:form id="testFragmentXYZ">
    #{card.owner.address.currentNumber}
    </h:form>

  3. #3
    Join Date
    Jan 2010
    Posts
    19

    Default

    thx, that already helped me, its working.
    too much confusion with fragments i guess.


    so far I have only been able to get it to work with forms (passing the form id into the render.fragfments attribute, e.g. <render fragments="myFormId" />

    the problem is, that I want to partially render the form.

    I could not find any info about which components I can use in the fragments attribute of render. if i use a div, it doesnt work, a outputlabel doesnt work.

  4. #4
    Join Date
    Nov 2008
    Posts
    742

    Default

    To my knowledge, only JSF elements will work. HTML is out, and I've never had any success with ui:fragment, which is a faclets tag with no relation or connection to the render fragments action in SWF.

  5. #5
    Join Date
    Jan 2010
    Posts
    19

    Default

    in the booking example, they use a "fragment". if the fragment is within a form they address it formid:fragmentid. will try it tomorrow at work.

  6. #6

    Default

    Try adding a <div> as the first child of the ui:fragment. I believe its the contents of the fragment that are reloaded and not the fragment itself, therefore fragment needs a root node.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •