Rewriting the generated DOM sounds so easy but... How can I accomplish that?
I'm facing some problems with that approach...
I tried to make that dummy-code working:
.tml
<t:grid ... t:mixins="GridFooter" >
<p:foot>
<tr><td>my footer</td></tr>
</p:foot>
</t:grid>
First problem was to get a <tfoot> tag rendered around the block "foot"
that I specified as a parameter for the mixin. I tried several things,
but I think I need a little help here.
This is not working, but shows how I'd like to do it:
@Parameter(name = "foot", defaultPrefix = BindingConstants.LITERAL)
private Block foot;
private Element tfoot, table;
@BeginRender
void renderBegin(MarkupWriter writer) {
tfoot = writer.element("tfoot");
}
@BeginRender
Object renderFoot(MarkupWriter writer) {
return foot;
}
@BeginRender
void renderTagEnd(MarkupWriter writer) {
writer.end(); // end tfoot
}
Instead of the desired markup this will render <tfoot></tfoot> followed
by the contents of the "foot"-block although the render methods are
called in the right order. I cannot end <tfoot> in the afterRender
method because it would wrap around the whole t5-grid, and moving it in
the dom would be even more difficult. So how can I wrap some markup
around a block?
Second, I didn't make it to get the table element of the grid. I hope
afterRender is the right place for that.
void afterRender(MarkupWriter writer) {
Element gridElement = ... // that should point to grid's
sorrounding div
table = gridElement.find("./div/table");
tfoot.moveToBottom(table);
}
I don't know if that xpath command would work if I'd find the
gridElement in the first place, but apart from that it should work like
that, right? How can I get the gridElement?
The autocompleter mixin and some others I've seen are injecting their
containers (@InjectContainer ... someField) and calling
someField.getClientId, which would maybe a solution if grid contained a
getClientId method...
I'm open for any ideas :)
Thanks so far,
Christian
Thiago H. de Paula Figueiredo schrieb:
Em Wed, 02 Dec 2009 15:41:12 -0200, Christian Riedel
<christian-rie...@gmx.net> escreveu:
Hi,
Hi!
I'd like to put a <tfoot> tag inside my table, but it seems the
Tapestry Grid component is not able to do that... or can somebody
point out a solution?
You can write a mixin that rewrites the generated DOM and adds the tag
you want. Take a look at the Autocomplete mixin source to have an idea.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org