You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Steve Chan <sc...@powersteeringsoftware.com> on 2005/08/12 00:15:05 UTC
Form rewind problem when sorting using contrib:Table
Hi All,
I am having trouble with the table component. Because of css table
styles, I had
to override the column renderer for the table component (form and
non-form) since
they were rendered inside a table and looked funny when our stylesheets
were applied.
My solution is pretty simple and worked fine in Tapestry 3. I recently
upgraded to
4.0 beta 3. The table renders fine but I once I sort on any column I
get:
You have clicked on a stale link.
Rewind of form Home/form expected allocated id #4 to be 'condSort', but
was 'condSorted$0' (requested by component
MyTableColumnPage/myTableColumnFormComponent.condSorted).
For reference here is the html for the table:
<form jwcid="form">
<div class="tableClass">
<span
jwcid="myTableView">
<br/>
<table
width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td jwcid="tableColumns"/>
</tr>
<tr jwcid="tableFormRows">
<td jwcid="tableValues" />
</tr>
</table>
</span>
</div>
</form>
And here are the relevant components:
<component id="form" type="Form">
</component>
<component id="myTableView" type="MyTableView">
<binding name="source" expression="page.sampleData"/>
<binding name="columns">
'* Name:name, ' +
'Owner:owner, ' +
'StDate:dt, ' +
'Status:status, ' +
'ForeCost:fore_Cost, ' +
'ActualCost:actual_cost, ' +
'Login:login, ' +
'Issues:num_issues '
</binding>
<static-binding name="pageSize" value="6"/>
<static-binding name="element">span</static-binding>
</component>
<component id="tableColumns" type="contrib:TableColumns">
<binding name="column" expression="page.column"/>
</component>
<component id="tableFormRows" type="contrib:TableFormRows">
<binding name="row" expression="currentRow"/>
<binding name="class"
expression="beans.rowClass3.next"/>
</component>
<component id="tableValues" type="contrib:TableValues">
</component>
Also here is my hivemodule.xml I used to ovveride the renderer:
<service-point id="MyTableColumnSource"
interface="org.apache.tapestry.contrib.table.model.IAdvancedTableColumnS
ource">
<invoke-factory>
<construct class="MyTableColumnSource">
<set-service property="expressionEvaluator"
service-id="tapestry.ognl.ExpressionEvaluator"/>
</construct>
</invoke-factory>
</service-point>
<service-point id="MyTableColumnModelSource"
interface="org.apache.tapestry.contrib.table.components.TableColumnModel
Source">
<invoke-factory>
<construct class="MyTableColumnModelSourceImpl">
<set-service property="expressionEvaluator"
service-id="tapestry.ognl.ExpressionEvaluator"/>
</construct>
</invoke-factory>
</service-point>
And here are the steps I took (I know it looks like a lot to do so
little):
1) Replaced SimpleTableColumnComponent.jwc and html,
SimpleFormTableColumnComponent.jwc and html
and SimpleTableColumn.page with my own, ie,
MyTableColumnFormComponent, MyTableColumnComponent
and MyTableColumn.page.
The only difference is that the html for the column headers are not
rendered inside of a table. They still use
SimpleTableColumnFormComponent.java abd
SimpleTableColumnComponent.java.
2) Replaced TableColumns.java with my own, MyTableColumn.java, where
only changes were to DEFAULT_COLUMN_RENDERER_SOURCE and
FORM_COLUMN_RENDERER_SOURCE to point to my own column renderers.
3) Created my column renderers from step 2 (one for form and one for
non-form). Basically just changed:
ComponentAddress objAddress =
new ComponentAddress(
objSource.getNamespace(),
"SimpleTableColumnPage",
"tableColumnFormComponent");
To:
ComponentAddress objAddress =
new ComponentAddress(
objSource.getNamespace(),
"MyTableColumnPage",
"MyTableColumnFormComponent");
4) Replaced all references to TableColumn.FORM_COLUMN_RENDERER_SOURCE
and DEFAULT_COLUMN_RENDERER_SOURCE
with my own. Unfortunately this meant replacing
TableColumnModelSourceImpl with MyTableColumnModelSourceImpl
hence the hivemind changes.
5) Replace all references to TableColumns.java with
MyTableColumns.java. Unfortunately this meant replacing
DefaultTableColumnSource with MyTableColumnSource.
6) Added my own TableView.jwc which has
<inject property="modelSource"
object="service:myPath.MyTableColumnModelSource"/>
<inject property="columnSource"
object="service:myPath.MyTableColumnSource"/>
to use the new renderers.
I tried basically the same thing in Tapestry 3 and it worked fine. I
looked into this problem for a while
and I think I am definitely on the wrong track. Any help would be
appreciated.
Thanks,
Steve