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

Reply via email to