Vue UI Components Documentation

Vue NavigationBar Component

The NavigationBar component for Vue represents a widget that has header and content sections (like tabs).

Prerequisites

Refer to Vue Getting Started before you start with this help topic.

Configuration

After you have created your App.vue file, here is how you should structure it:

The NavigationBar component for Vue requires the following import:


Add the jqxNavigationBar component to the components section of the the Vue class:


Template

The App.vue has a <template> structural tag where we determine the application structure. There we will also set the tags for the new components - <JqxNavigationBar/>

<template>
<JqxNavigationBar :expandMode="expandMode"
:width="width"
:height="height">
<!--Header-->
<div>
Early History of the Internet
</div>
<!--Content-->
<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>
<!--Header-->
<div>
Merging the networks and creating the Internet
</div>
<!--Content-->
<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>
<!--Header-->
<div>
Popular Internet services
</div>
<!--Content-->
<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>
</JqxNavigationBar>
</template>

Properties

The properties of the <JqxNavigationBar/> component are defined in the data member of the Vue class. We should put them in the return object of the data function:

data: function () {
return {
expandMode: 'toggle',
width: 400,
height: 480
}
}

Events

The events in Vue are set as an attribute with @ prefix, for example:

<JqxNavigationBar @expandedItem="onItemExpanded()"
:expandMode="expandMode"
:width="width"
:height="height">
<!--Header-->
<div>
Early History of the Internet
</div>
<!--Content-->
<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>
<!--Header-->
<div>
Merging the networks and creating the Internet
</div>
<!--Content-->
<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>
<!--Header-->
<div>
Popular Internet services
</div>
<!--Content-->
<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>
</JqxNavigationBar>

All events that are bound to a component are implemented in the methods member of the Vue class.

methods: {
onItemExpanded: function () {
// Do something...
}
}

Methods

To use a component's method we should have its reference. In Vue we refer to a component by the special $refs property. Before that we need to add the desired name reference to that component:

<JqxNavigationBar ref="navigationbar"></JqxNavigationBar>

Here how you can use a component's method:

this.$refs.navigationbar.refresh();

methods: {
// Add here all used callbacks and/or events
onItemExpanded: function () {
// Do something...
this.$refs.navigationbar.refresh();
}
}

If we want to add additional methods we should also implement them in the methods member.

In case we need to do some precalculation or something else before the components are rendered, we should use the beforeCreate member. It depends on the case.

If you have followed the above steps, you App.vue file would look like this:

App.vue:

<template>
<JqxNavigationBar ref="navigationbar" @expandedItem="onItemExpanded()"
:expandMode="expandMode" :width="width"
:height="height">
<!--Header-->
<div>
Early History of the Internet
</div>
<!--Content-->
<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>
<!--Header-->
<div>
Merging the networks and creating the Internet
</div>
<!--Content-->
<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>
<!--Header-->
<div>
Popular Internet services
</div>
<!--Content-->
<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>
</JqxNavigationBar>
</template>
<script>
// Import the components that will be used
import JqxNavigationBar from "jqwidgets-scripts/jqwidgets-vue/vue_jqxnavigationbar.vue";
export default {
components: {
// Adding imported widgets here
JqxNavigationBar
},
data: function () {
// Define properties which will use in the widget
return {
expandMode: 'toggle',
width: 400,
height: 480
}
},
beforeCreate: function () {
// Add here any data where you want to transform before components be rendered
},
methods: {
// Add here all used callbacks and/or events
onItemExpanded: function () {
// Do something...
this.$refs.navigationbar.refresh();
}
}
}
</script>
<style>
</style>

NavigationBar Example

<template>
<div style="float: left;">
<JqxNavigationBar @collapsedItem="collapsedItem($event)"
@expandedItem="expandedItem($event)"
:expandMode="'singleFitHeight'"
:height="430"
:width="400">
<!--Header-->
<div>
Early History of the Internet
</div>
<!--Content-->
<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>
<!--Header-->
<div>
Merging the networks and creating the Internet
</div>
<!--Content-->
<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>
<!--Header-->
<div>
Popular Internet services
</div>
<!--Content-->
<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>
</JqxNavigationBar>
<div style="margin-left: 20px; font-size: 12px; font-family: Verdana, Geneva, DejaVu Sans, sans-serif; margin-top: 50px; float: left;">
<div>
<span>Events:</span>
<JqxPanel ref="events" :height="250" :width="420">
</JqxPanel>
</div>
</div>
</div>
</template>
<script>
import JqxNavigationBar from "jqwidgets-scripts/jqwidgets-vue/vue_jqxnavigationbar.vue"
import JqxPanel from "jqwidgets-scripts/jqwidgets-vue/vue_jqxpanel.vue"
export default {
components: {
JqxNavigationBar,
JqxPanel
},
methods: {
getName: function (index) {
switch (index) {
case 0:
return 'Early History of the Internet';
case 1:
return 'Merging the networks and creating the Internet';
case 2:
return 'Popular Internet services';
}
},
collapsedItem: function (event) {
let text = this.getName(event.item);
this.$refs.events.prepend('<div style="margin-top: 5px;">Collapsed: ' + text + '</div>');
},
expandedItem: function (event) {
let text = this.getName(event.item);
this.$refs.events.prepend('<div style="margin-top: 5px;">Expanded: ' + text + '</div>');
}
}
}
</script>
<style>
html, body {
width: 100vw;
height: 100vh;
padding: 0;
margin: 0;
}
.jqx-panel {
border: none;
}
</style>

Run Code