Ok, so you are indeed looking for a way to change a html attribute ;-)
Since you wrote (in your folluw-up e-mail) that you cannot generate the
html, there are some ways, but they mostly work outside of the normal
wicket way.
1) In the component which actually renders your static html override
onComponentTagBody and fiddle with the markup stream (e.g. look at
replaceComponentTagBody)
2) store the static html somewhere by itself, and create a custom model.
The model can then load the html and perform string replacement.
You can then add a label component which uses the model and has
setEscapeModelStrings(false) set.
Met vriendelijke groet,
Kind regards,
Bas Gooren
Op 23-1-2013 21:11, schreef Michael Jaruska:
I need to find the parent <li> tag of the anchor user clicks - I now
from PageParameters which anchor
has been clicked. Then I will put into this parent <li> specific
atribute (id="something"). This attribute
will be then processed by JavaScript on the page.
On 23.1.2013 21:04, Bas Gooren wrote:
Sorry, I read too quickly.
What are you trying to accomplish? Let's say you are able to find the
appropriate html tag, what do you want to do with it?
Met vriendelijke groet,
Kind regards,
Bas Gooren
Op 23-1-2013 21:01, schreef Michael Jaruska:
And question is not "how can I change html attribute" but "how can I
go through html structure" and
find html tag with specific attribute :-)
On 23.1.2013 20:50, Bas Gooren wrote:
Hi!
What you want to accomplish (e.g. changing some html attributes)
can be done by adding an attributemodifier to each <li> component.
In pseudocode:
RepeatingView uls = ...
for_every_li:
WebMarkupContainer li = ...
uls.add(li);
now, you can do something like this:
li.add(new AttributeAppender(...) {
isEnabled() {
return true if you want to append a html attribute;
}
});
Or alternatively:
WebMarkupContainer li = new WMC() {
onComponentTag(ComponentTag tag) {
super(tag);
tag.put("my-html-attribute", value);
}
}
Met vriendelijke groet,
Kind regards,
Bas Gooren
Op 23-1-2013 20:45, schreef Michael Jaruska:
Hi,
is there a way I can find specific html tag in markup?
I have this html structure:
<ul class="mymenu">
<li>
<a href="./mypage.html?cid=menu">menu</a>
<ul>
<li>
<a href="./mypage.html?cid=menu/submenu">submenu</a>
<ul>
<li>
<a
href="./mypage.html?cid=menu/submenu/subsubmenu1">subsubmenu1</a>
</li>
<li>
<a
href="./mypage.html?cid=menu/submenu/subsubmenu2">subsubmenu2</a>
</li>
<li>
<a
href="./mypage.html?cid=menu/submenu/subsubmenu3">subsubmenu3</a>
</li>
</ul>
</ul>
</ul>
I'm processing clicks on anchors with my page:
public PageTest(PageParameters parameters){
//cid = category id
String category = parameters.get("cid").toString();
...
}
Now I need some way I can add atribute into parent <li> tag of <a>
tag on which I do click.
Somethink like (pseudocode):
public PageTest(PageParameters parameters){
//cid = category id
String category = parameters.get("cid").toString();
//find corresponding <a> tag
Tag anchorTag =
go_from_top_ul_tag_and_find_a_tag_by_category(category)
//have corresponding anchor tag, get parrent tag of the anchor tag
Tag anchorParentTag = anchorTag.getParent();
//and now I can do my mysterious things with menu...
}
But I don't know where to start my search and I totaly don't know
whot to look for in docu.
Please, help :-)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org