You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Бурлака Денис <bu...@yandex.ru> on 2007/05/04 11:19:37 UTC

How update component on the page

Hello.
I have made a simple form and table on the page. I send async AJAX request to the server, then I update model (List<Item>) on the server side and then I update table component on the page. But table component does't change. Here some code:

Home.html page:
<html jwcid="@Shell" title="Tapestry-4.1.1" browserLogLevel="info" debugEnabled="true" consoleEnabled="true">
	<body jwcid="@Body">
		<form jwcid="form@Form" async="true">
			<input type="text" jwcid="name@TextField" value="ognl:item.name"/>
			<input type="submit" value="Ok"/>
		</form>

		<table border="1" jwcid="table@contrib:Table"
				source="ognl:items"
				columns="literal:name">
			<tr>
				<th>name</th>
			</tr>
			<tr>
				<td></td>
			</tr>
		</table>
	</body>
</html>


HomePage.java class:
public abstract class HomePage extends BasePage implements PageBeginRenderListener {

	public abstract Item getItem();

	public abstract void setItem(Item item);

	@Persist
	public abstract List<Item> getItems();

	public abstract void setItems(List<Item> items);

	public void pageBeginRender(PageEvent arg0) {
		if (getItem() == null) {
			setItem(new Item());
		}
		if (getItems() == null) {
			setItems(new ArrayList<Item>());
		}
	}

	@EventListener (
			targets = "form",
			events = "onsubmit",
			submitForm = "form"
	)
	public void projectSelected(IRequestCycle cycle) {
		getItems().add(getItem());
		cycle.getResponseBuilder().updateComponent("table");
	}

}

AJAX response:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
	<!ENTITY nbsp '&#160;'>
]>
<ajax-response>
	<response id="table" type="element">
		<div id="tableView">
			<table border="1" id="tableElement">
				<tr>
					<th class="nameColumnHeader" id="informal">
						<table class="tableHeaderTable" >
							<tr>
								<td><a id="linkColumn" href="/tapestry-proba/app?component=tableColumnComponent.linkColumn&amp;container=contrib%3ASimpleTableColumnPage&amp;page=Home&amp;service=direct&amp;session=T&amp;sp=AHome%2Ctable.tableView&amp;sp=Sname">name</a></td>
							</tr>
						</table>
					</th>
				</tr>
				<tr id="informal_0">
					<td class="nameColumnValue" id="informal_1">1255</td>
				</tr>
			</table>
		</div>
	</response>
</ajax-response>

and error: No node could be found to update content in with id table.

What I'm doing wrong? Could somebody help me?

Thanks a lot.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: How update component on the page

Posted by Jani Lindqvist <ac...@gmail.com>.
I just experienced exactly the same problem with RenderBlock and worked
around wrapping it with Any.

should update work directly with RenderBlock id, or not. I'd guess it should
but if not, is there other special components that aren't?

On 5/4/07, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> Ah I remember this - I think there's still actually a ticket open for
> it...The gist of it is that the @Table component doesn't honor the
> component
> id you pass in to it, so there probably really isn't an element on your
> rendered page with a id="table" attribute.
>
> You can get around this for now by doing something like:
>
> <span jwcid="tableArea@Any" >
> // table in here...
> </span>
>
> But I'll try to make sure that gets fixed in table before 4.1.2 goes out.
> Sorry for the confusion.
>
> On 5/4/07, Бурлака Денис <bu...@yandex.ru> wrote:
> >
> > Hello.
> > I have made a simple form and table on the page. I send async AJAX
> request
> > to the server, then I update model (List<Item>) on the server side and
> then
> > I update table component on the page. But table component does't change.
>
> > Here some code:
> > <snipped>
> >
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>

Re: How update component on the page

Posted by Jesse Kuhnert <jk...@gmail.com>.
Ah I remember this - I think there's still actually a ticket open for
it...The gist of it is that the @Table component doesn't honor the component
id you pass in to it, so there probably really isn't an element on your
rendered page with a id="table" attribute.

You can get around this for now by doing something like:

<span jwcid="tableArea@Any" >
 // table in here...
</span>

But I'll try to make sure that gets fixed in table before 4.1.2 goes out.
Sorry for the confusion.

On 5/4/07, Бурлака Денис <bu...@yandex.ru> wrote:
>
> Hello.
> I have made a simple form and table on the page. I send async AJAX request
> to the server, then I update model (List<Item>) on the server side and then
> I update table component on the page. But table component does't change.
> Here some code:
> <snipped>
>

-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

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