menu highlight

Forum rules
Please note that response time for technical support is within 3-5 business days.
mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

29 Jun 2017, 07:53

I couldn't replicate this issue. Which Ultima version are you using?

sistemaslume
Posts: 12
Joined: 17 May 2016, 19:13

20 Nov 2017, 15:31

Hi, we use version 1.0.5 and have the same problem reported by wandyer

Any sugestions??
wandyer wrote:
27 Jun 2017, 05:32
aragorn wrote:
13 Jun 2017, 10:18
Could you please try the following code?

Code: Select all

<script type="text/javascript">
    //<![CDATA[
    $(document).ready(function() {
        var $this = PF('me');
        if($this) {
            var pathname = window.location.pathname;
            if(pathname.indexOf('.xhtml') > 0) {
                var activeLink = $this.menulinks.filter('[href^="' + pathname + '"]');
                $this.expandedMenuitems = [];
                $this.clearMenuState();

                var item = activeLink.parent('li');
                $this.addMenuitem(item.attr('id'));
                addParentItems($this, item);
                rc();
            }
        }
    });

    function addParentItems($this, item) {
        if(item && item.length) {
            var parent = item.parents('li:first');
            $this.addMenuitem(parent.attr('id'));
            if(!parent.parent('ul').hasClass('ultima-menu')) {
                addParentItems($this, parent);
            }
            else {
                return;
            }
        }
        return;
    }
    //]]>
</script>
//menu.xhtml

Code: Select all

<h:form id="menuform"> 
   ....
   <p:remoteCommand name="rc" update="menuform:menu" />
                                     
   <pu:menu id="menu" widgetVar="me">
    ..
The line:

Code: Select all

rc();
makes any top-bar item stop working for me, including the main menu button.

If I remove that line, they start working again but the menus are not highlighted anymore when I open the page from a URL.

My menu.xhtml:

Code: Select all

...
<p:remoteCommand name="rc" update="menuform:menu" />

<pu:menu id="menu" widgetVar="me" model="#{menuView.model}" />
...

wandyer
Posts: 7
Joined: 15 Dec 2016, 02:09

24 Nov 2017, 19:46

sistemaslume wrote:
20 Nov 2017, 15:31
Hi, we use version 1.0.5 and have the same problem reported by wandyer

Any sugestions??
wandyer wrote:
27 Jun 2017, 05:32
aragorn wrote:
13 Jun 2017, 10:18
Could you please try the following code?

Code: Select all

<script type="text/javascript">
    //<![CDATA[
    $(document).ready(function() {
        var $this = PF('me');
        if($this) {
            var pathname = window.location.pathname;
            if(pathname.indexOf('.xhtml') > 0) {
                var activeLink = $this.menulinks.filter('[href^="' + pathname + '"]');
                $this.expandedMenuitems = [];
                $this.clearMenuState();

                var item = activeLink.parent('li');
                $this.addMenuitem(item.attr('id'));
                addParentItems($this, item);
                rc();
            }
        }
    });

    function addParentItems($this, item) {
        if(item && item.length) {
            var parent = item.parents('li:first');
            $this.addMenuitem(parent.attr('id'));
            if(!parent.parent('ul').hasClass('ultima-menu')) {
                addParentItems($this, parent);
            }
            else {
                return;
            }
        }
        return;
    }
    //]]>
</script>
//menu.xhtml

Code: Select all

<h:form id="menuform"> 
   ....
   <p:remoteCommand name="rc" update="menuform:menu" />
                                     
   <pu:menu id="menu" widgetVar="me">
    ..
The line:

Code: Select all

rc();
makes any top-bar item stop working for me, including the main menu button.

If I remove that line, they start working again but the menus are not highlighted anymore when I open the page from a URL.

My menu.xhtml:

Code: Select all

...
<p:remoteCommand name="rc" update="menuform:menu" />

<pu:menu id="menu" widgetVar="me" model="#{menuView.model}" />
...

I fixed that problem, but can't remember exactly what I did. I know that I ended up making significant changes to that script provided by argon, because I wanted some custom behaviours.

But I think what fixed the issue of the topbar, I added ignoreAutoUpdate="true" to the p:remoteCommand

Like this:

Code: Select all

<p:remoteCommand name="rc" update="menu" ignoreAutoUpdate="true"/>
If it doesn't work, then I'll provide my script to highlight the menus dynamically

wandyer
Posts: 7
Joined: 15 Dec 2016, 02:09

24 Nov 2017, 20:01

I just tested without ignoreAutoUpdate="true" , and it still works. Now I think I used that property to fix something else.

I reverted the changes on most of my classes and I can't reproduce this issue again on version 1.1, so I'm not so sure what caused it.

spadovan
Posts: 178
Joined: 05 Jun 2013, 12:04

13 Aug 2021, 11:07

Hi this solution no longer works with Ultima 3.0.0, could you please give me the fix ?
thanks
Primefaces 12.0.2, Wildfly 24.0.1, JDK 11

siris
Posts: 322
Joined: 29 Jul 2019, 13:57

16 Aug 2021, 07:15

Hi,

Answered in another topic: viewtopic.php?f=42&t=68297&p=193566#p193566

Best Regards,

Post Reply

Return to “Ultima - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests