jQuery UI Widgets Forums Navigation NavigationBar, ToolBar, NavBar is there any function to remember which navigation bar user has opened

This topic contains 6 replies, has 2 voices, and was last updated by  Dimitar 9 years, 6 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author

  • pankhi
    Participant

    i am using jqxNavigationBar . is there any functionality to remember user’s selection what user has marked oped or close . so that next time when user open site we will show the previously opened navigation in Expanded .


    Dimitar
    Participant

    Hello pankhi,

    Here is shown how to achieve this requirement using cookies: http://www.jqwidgets.com/community/topic/keep-state/#post-20230.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    pankhi
    Participant

    The solution given by you i working fine.. but it keeps only one navigation bar open. what if i want to open more than one navigation bar?


    Dimitar
    Participant

    Hi pankhi,

    Here is an updated version of the example:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxnavigationbar.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var expanded0 = $.jqx.cookie.cookie("jqxNavigationBar0");
                var expanded1 = $.jqx.cookie.cookie("jqxNavigationBar1");
                var expanded2 = $.jqx.cookie.cookie("jqxNavigationBar2");
    
                var expandedArray = [];
    
                if (expanded0) {
                    expandedArray.push(0);
                }
                if (expanded1) {
                    expandedArray.push(1);
                }
                if (expanded2) {
                    expandedArray.push(2);
                }
    
                $("#jqxNavigationBar").jqxNavigationBar({ width: 400, height: 'auto', expandMode: "multiple", expandedIndexes: expandedArray });
                $('#jqxNavigationBar').on('expandedItem', function (event) {
                    var expandedItem = event.args.item;
                    $.jqx.cookie.cookie("jqxNavigationBar" + expandedItem, true);
                });
            });
        </script>
    </head>
    <body class='default'>
        <div id='jqxWidget' style="float: left;">
            <div id='jqxNavigationBar'>
                <div>
                    Early History of the Internet</div>
                <div>
                    <ul>
                        <li>1961 First packet-switching papers</li>
                        <li>1966 Merit Network founded</li>
                        <li>1966 ARPANET planning starts</li>
                        <li>1969 ARPANET carries its first packets</li>
                        <li>1970 Mark I network at NPL (UK)</li>
                        <li>1970 Network Information Center (NIC)</li>
                        <li>1971 Merit Network's packet-switched network operational</li>
                        <li>1971 Tymnet packet-switched network</li>
                        <li>1972 Internet Assigned Numbers Authority (IANA) established</li>
                        <li>1973 CYCLADES network demonstrated</li>
                        <li>1974 Telenet packet-switched network</li>
                        <li>1976 X.25 protocol approved</li>
                        <li>1979 Internet Activities Board (IAB)</li>
                        <li>1980 USENET news using UUCP</li>
                        <li>1980 Ethernet standard introduced</li>
                        <li>1981 BITNET established</li>
                    </ul>
                </div>
                <div>
                    Merging the networks and creating the Internet</div>
                <div>
                    <ul>
                        <li>1981 Computer Science Network (CSNET)</li>
                        <li>1982 TCP/IP protocol suite formalized</li>
                        <li>1982 Simple Mail Transfer Protocol (SMTP)</li>
                        <li>1983 Domain Name System (DNS)</li>
                        <li>1983 MILNET split off from ARPANET</li>
                        <li>1986 NSFNET with 56 kbit/s links</li>
                        <li>1986 Internet Engineering Task Force (IETF)</li>
                        <li>1987 UUNET founded</li>
                        <li>1988 NSFNET upgraded to 1.5 Mbit/s (T1)</li>
                        <li>1988 OSI Reference Model released</li>
                        <li>1988 Morris worm</li>
                        <li>1989 Border Gateway Protocol (BGP)</li>
                        <li>1989 PSINet founded, allows commercial traffic</li>
                        <li>1989 Federal Internet Exchanges (FIXes)</li>
                        <li>1990 GOSIP (without TCP/IP)</li>
                        <li>1990 ARPANET decommissioned</li>
                    </ul>
                </div>
                <div>
                    Popular Internet services</div>
                <div>
                    <ul>
                        <li>1990 IMDb Internet movie database</li>
                        <li>1995 Amazon.com online retailer</li>
                        <li>1995 eBay online auction and shopping</li>
                        <li>1995 Craigslist classified advertisements</li>
                        <li>1996 Hotmail free web-based e-mail</li>
                        <li>1997 Babel Fish automatic translation</li>
                        <li>1998 Google Search</li>
                        <li>1999 Napster peer-to-peer file sharing</li>
                        <li>2001 Wikipedia, the free encyclopedia</li>
                        <li>2003 LinkedIn business networking</li>
                        <li>2003 Myspace social networking site</li>
                        <li>2003 Skype Internet voice calls</li>
                        <li>2003 iTunes Store</li>
                        <li>2004 Facebook social networking site</li>
                        <li>2004 Podcast media file series</li>
                        <li>2004 Flickr image hosting</li>
                        <li>2005 YouTube video sharing</li>
                        <li>2005 Google Earth virtual globe</li>
                    </ul>
                </div>
            </div>
        </div>
    </body>
    </html>

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    pankhi
    Participant

    is there any way to count the number of navigation bars so that rather than defining the each bar( var expanded0 = $.jqx.cookie.cookie(“jqxNavigationBar0”);) we can do it with the help of loop?


    pankhi
    Participant

    the above code is not working properly.. it keeps All the navigation bars open and didnot close if I close the navigation bar


    Dimitar
    Participant

    Hello

    1. Here is how to get the number of navigation bar items:
      var numberOfItems = $('#jqxNavigationBar .jqx-expander-header').length;
    2. Collapsing the navigation bar is not handled in our example. To do this, you would have to bind to the collapsedItem event and set the cookie corresponding to the collapsed item to false.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.