I am new to Tacos but I am having problems updating components.
I have a very simple example that has a list of animals and next to it is an
AjaxDirectLink, when clicked it toggles between the text Hide and Show. The top
group uses span tags and this updates the text correctly. The bottom group uses
tables but when the link is clicked it displays the hourglass which never goes
away. In the Java Script console I get "parentNode has no properties".
I am using Tapestry 4.0.2, and the latest Tacos nightly build
4-beta-3-20060509-1708
Any help will be appreciated.
thankyou
Carmen
.html
<html>
<head>
<script type="text/javascript">
djconfig = { isDebug: true,
baseRelativePath: "js/dojo/",
preventBackButtonFix: false };
</script>
<script type="text/javascript" src="/js/dojo/dojo.js"></script>
</head>
<body jwcid="@Body">
This uses span tags<br/>
<span jwcid="foreachItem" >
<div jwcid="@Any" id="ognl:item.toString()" >
<a jwcid="linkToggle">
<span jwcid="@Insert"
value="ognl:selected ? 'Hide' : 'Show'"/>
</a>
<span jwcid="@Insert" value="ognl:item" />
</div>
</span>
<br/><br/>
<!-- Using tables instead -->
This uses tables
<table>
<tr jwcid="tableItems" >
<td>
<div jwcid="@Any"
id="ognl:tableItem.toString()" >
<a jwcid="linkTableToggle">
<span jwcid="@Insert"
value="ognl:tableItemSelected ? 'Hide' : 'Show'"/>
</a>
<span jwcid="@Insert"
value="ognl:tableItem" />
</div>
</td>
</tr>
</table>
</body>
</html>
.page
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<page-specification class="pages.test.TestTacosDirectLink">
<description><![CDATA[ Test Tacos Direct Link ]]></description>
<property name="selectedItems" persist="session"
initial-value="ognl:new java.util.TreeSet()"/>
<component id="foreachItem" type="tacos:PartialFor">
<binding name="source" value="items"/>
<binding name="value" value="item"/>
</component>
<component id="linkToggle" type="tacos:AjaxDirectLink">
<binding name="listener" value="listener:toggleItem"/>
<binding name="parameters" value="ognl:item.toString()"/>
<binding name="updateComponents"
value="ognl:{item.toString()}"/>
</component>
<!-- Animals using a table instead of span tags -->
<property name="selectedTableItems" persist="session"
initial-value="ognl:new java.util.TreeSet()"/>
<component id="tableItems" type="tacos:PartialFor">
<binding name="source" value="tableItems"/>
<binding name="value" value="tableItem"/>
<binding name="element" value="literal:tr"/>
</component>
<component id="linkTableToggle" type="tacos:AjaxDirectLink">
<binding name="listener" value="listener:toggleTableItem"/>
<binding name="parameters" value="ognl:tableItem.toString()"/>
<binding name="updateComponents"
value="ognl:{tableItem.toString()}"/>
</component>
</page-specification>
.java
package pages.test;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;
public abstract class TestTacosDirectLink extends BasePage {
public List getItems(){
List items = new ArrayList();
items.add("cattle dog");
items.add("cat");
items.add("parrot");
return items;
}
public void toggleItem(IRequestCycle cycle) {
String item = (String)cycle.getListenerParameters()[0];
Set s = getSelectedItems();
if (s.contains(item)) {
s.remove(item);
} else {
s.add(item);
}
setSelectedItems(s);
}
public boolean isSelected() {
return getSelectedItems().contains(getItem());
}
public abstract String getItem();
public abstract Set getSelectedItems();
public abstract void setSelectedItems(Set selectedItems);
public List getTableItems(){
List items = new ArrayList();
items.add("pig");
items.add("rooster");
items.add("duck");
return items;
}
public void toggleTableItem(IRequestCycle cycle) {
String item = (String)cycle.getListenerParameters()[0];
Set s = getSelectedTableItems();
if (s.contains(item)) {
s.remove(item);
} else {
s.add(item);
}
setSelectedTableItems(s);
}
public boolean isTableItemSelected() {
return getSelectedTableItems().contains(getTableItem());
}
public abstract String getTableItem();
public abstract Set getSelectedTableItems();
public abstract void setSelectedTableItems(Set selectedItems);
}
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid7521&bid$8729&dat1642
_______________________________________________
Tacos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tacos-devel