Is "orderarea" a component or html element? updateComponents() only
works with components. You could also just as easily put that in the
html part:

<a jwcid="@DirectLink" listener="listener:changeTab"
 parameters="4" async='true' class="tab" updateComponents="orderarea">

Sounds to me like your orderarea just isn't a component. It might work
better if you did something like :

<div jwcid="[EMAIL PROTECTED]">
// content
</div>

instead..

Besides the examples here:

http://tapestry.apache.org/tapestry4.1/ajax/eventlistener.html

You can also find information on debugging here:

http://tapestry.apache.org/tapestry4.1/ajax/debugging.html

On 2/16/07, Murray Collingwood <[EMAIL PROTECTED]> wrote:
Hi guys

Great responses - both were exactly right.

However both lacked any reference to a simple example to get Ajax calls working
in Tapestry 4.1.  If anybody has one I'd be keen to see it?

I have watched this list long enough to know it is possible yet as much as I try
I'm still not getting the page portion updating - and worse, there are no
obvious errors happening either.

I'm using Firefox/Firebug which is really helpful:

I'm sending:
GET http://localhost:8080/cabs/order/Main,$DirectLink_1.sdirect?
  sp=S3&updateParts=orderarea&beventtarget.id=DirectLink_1&
  beventname=onClick&dojo.preventCache=1171662192656

And being returned is:
<ajax-response></ajax-response>

As background, this is supposedly creating a tab style page, and when a tab is
clicked the area inside <div id='orderarea'>the tabs area included in here along
with the main tab area</div> should be updated.

So, I'm going to assume my html is correct, however just for the record:
<div id='orderarea'>
...
<a jwcid="@DirectLink" listener="listener:changeTab"
   parameters="4" async='true' class="tab">
<span jwcid='@Insert' value='ognl:getTabtext(4)'>Dates</span>
</a>
...
</div>

Most of the action happens in the java file associated with this page:

public abstract class Main {

private static final String tabtext[] = {
   "Customer",
   "Style",
   "Components",
   "Dates"      };

public String getTabtext(Integer ix) {
        return tabtext[ix.intValue()-1];
}

public void changeTab(IRequestCycle cycle) {
        Object[] parameters = cycle.getListenerParameters();
        Integer iix = new Integer((String) parameters[0]);
        setCurrentTab(iix);
        System.err.println("Set tab to " + iix.intValue());
        cycle.getResponseBuilder().updateComponent("orderarea");
        System.err.println("Requested update to 'orderarea'");
}

public abstract Integer getCurrentTab();
public abstract void setCurrentTab(Integer ct);

// Plus some other stuff which is irrelevant
}

Is there something I'm missing here?  All of the log messages appear as expected
when I click the tab, so I know it's running, there's just no content coming
back in the response.

Cheers
mc



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to