wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Jaruska <michael.jaru...@gmail.com>
Subject Re: find html tag
Date Wed, 23 Jan 2013 20:11:50 GMT
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-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message