I've taken over a Vue (2.5.22) app with Vuetify (1.4.3), and the app has a left nav that uses v-list and v-list-group elements:
<template>
<v-list dark class="ap-sidebar-applist">
<v-list-group
class="ap-sidebar-group"
v-for="(item, i) in items"
:key="i"
:prepend-icon="item.icon"
:value="item.visible"
#click="onClick(item)"
>
<v-list-tile slot="activator">
<v-list-tile-title>{{ item.title }}</v-list-tile-title>
</v-list-tile>
<v-list-group
v-if="item.children"
sub-group
no-action
class="ap-sidebar-subgroup"
>
<v-list-tile slot="activator"
v-for="(subMenu, j) in item.children"
:key="j"
#click="onClick(subMenu, true)"
>
<v-list-tile-action>
<v-icon>{{ subMenu.icon }}</v-icon>
</v-list-tile-action>
<v-list-tile-title>{{ subMenu.title }}</v-list-tile-title>
</v-list-tile>
</v-list-group>
</v-list-group>
</v-list>
</template>
export default {
name: 'TheLeftSidebarAppList',
props: {
visible: Boolean,
},
data: () => ({
items: [
{
icon: 'group',
title: 'Users',
routeTo: 'UserEdit',
method: null,
superOnly: false,
taCanView: true,
visible: true,
children: [
{
icon: 'send',
title: 'Send Quick Alert',
method: 1,
},
],
},
{
icon: 'domain',
title: 'Tenants',
routeTo: 'TenantEdit',
method: null,
superOnly: false,
taCanView: true,
visible: false,
children: [
{
icon: 'fingerprint',
title: 'Manage Biometrics',
method: 1,
},
{
icon: 'email',
title: 'Manage Templates',
method: 1,
},
],
},
{
icon: 'assessment',
title: 'Reports',
routeTo: 'WorkspaceReports',
method: null,
superOnly: false,
taCanView: true,
visible: false,
},
{
icon: 'settings',
title: 'Server Configuration',
routeTo: null,
method: 2,
superOnly: false,
taCanView: false,
visible: false,
},
{
icon: 'trending_up',
title: 'Performance',
routeTo: 'WorkspacePerformance',
method: null,
superOnly: true,
taCanView: true,
visible: false,
},
],
}),
}
I want to add two items under the Tenants item by adding a children array in the data:
{
icon: 'domain',
title: 'Tenants',
routeTo: 'TenantEdit',
method: null,
superOnly: false,
taCanView: true,
visible: false,
children: [
{
icon: 'fingerprint',
title: 'Manage Biometrics',
method: 1,
},
{
icon: 'email',
title: 'Manage Templates',
method: 1,
},
],
},
but when it is displayed, the children items are displayed horizontally, instead of being stacked vertically:
From everything I've seen, they should stack vertically, but they don't. What do I need to do to get them to be stacked vertically?
UPDATE: This component is included in a parent component that wraps this in a <v-navigation-drawer> component:
<template>
<v-navigation-drawer
v-model="visible"
fixed
app
dark
class="primary"
>
<v-toolbar flat class="ap-img-toolbar">
<v-list class="pa-0">
<v-list-tile>
<v-list-tile-action>
<img src="/images/LogoSmall.png">
</v-list-tile-action>
</v-list-tile>
</v-list>
</v-toolbar>
<TheLeftSidebarAppList />
</v-navigation-drawer>
</template>
Remove the slot="activator" from the <v-list-tile> containing the children and that will take care of the horizontal issue.
I have created a working Codepen using your example.
Hope it helps :)
Related
I am not able to disable the button on form validation fails. I want to use regex: /^[0-9]+(,[0-9]+)*$/ for text area validation. I want to disable activatebutton.
I tried formBind and monitor validate still not working.
Here is the code:
items: [{
xtype: 'container',
layout: {
type: 'column'
},
items: [{
columnWidth: .75,
layout: "form",
monitorValid: true,
items: {
fieldLabel: 'Please Enter Activation Id',
name: 'Activate',
xtype: 'textarea',
msgTarget: 'under',
growMax: 200,
allowBlank: false,
blankText: "Please Enter Comma separated AssetIds",
regex: /^[0-9]+(,[0-9]+)*$/,
anchor: '100%'
}
}, {
columnWidth: .25,
items: {
xtype: 'button',
name: 'button',
id: 'activatebutton',
width: 100,
text: 'Set for auto-activation',
formBind: true,
listeners: {
click: function () {
shared.Notifier.success('The requ ');
this.seForActivation();
},
scope: this
}
}
}]
}]
In order for the formBind to work, you need to have an Ext.form.Panel.
The form panel will process the checks of the form fields and call the formBind when the whole form is valid.
The following code will propcess the formBind, see also the working Fiddle and the Ext.form.Panel documentation.
{
xtype: 'form',
layout: 'column',
items: [{
columnWidth: .75,
layout: "form",
monitorValid: true,
items: {
fieldLabel: 'Please Enter Activation Id',
name: 'Activate',
xtype: 'textarea',
msgTarget: 'under',
growMax: 200,
allowBlank: false,
blankText: "Please Enter Comma separated AssetIds",
regex: /^[0-9]+(,[0-9]+)*$/,
anchor: '100%'
}
}, {
columnWidth: .25,
items: {
xtype: 'button',
name: 'button',
id: 'activatebutton',
width: 100,
text: 'Set for auto-activation',
formBind: true,
listeners: {
click: function () {
shared.Notifier.success('The requ ');
this.seForActivation();
},
scope: this
}
}
}]
I am trying to get my Ext.Menu with a list to respond to my event in my Controller.
I am not sure why I can not get a response from the list in the Ext.Menu.
Could someone please tell me what I am missing.
Thanks
Ext.define('Pear.view.Main', {
extend: 'Ext.Container',
xtype: 'main',
requires: [
'Ext.Menu'
],
config: {
layout: {
type: 'card'
},
items: [
{
xtype: 'toolbar',
docked: 'top',
title: 'Sliding Menu',
items: [
{
xtype: 'button',
id: 'listButton',
iconCls: 'list',
ui: 'plain',
handler: function(){
if(Ext.Viewport.getMenus().left.isHidden()){
Ext.Viewport.showMenu('left');
}
else
{
Ext.Viewport.hideMenu('left');
}
}
}
]
}
]
},
initialize: function(){
Ext.Viewport.setMenu(this.createMenu(),{
side: 'left',
reveal: true
});
},
createMenu: function(){
var menu = Ext.create('Ext.Menu', {
layout: 'fit',
width: 220,
xtype:'menuList',
items: [{
xtype: 'titlebar',
title: 'Side menu'
}, {
xtype: 'list',
itemTpl: '{title}',
//store: 'Beginning',
data: [{
title: 'Menu item 1'
}, {
title: 'Menu item 2'
},
{
title: 'Menu item 3'
}, {
title: 'Menu item 4'
}]
}]
});
return menu;
}
});
My Controller
Ext.define( 'Pear.controller.Main', {
extend:'Ext.app.Controller',
config:{
refs: {
Main: 'main',
},
control: {
'main list ':{
itemtap:function(list,index,target,record){
console.log("Option 2 Tapped");
}
},
},
}
});
Your list reference is wrong. Best way to get the reference of an item is to set a config name property to that item like this:-
{
xtype: 'list',
itemTpl: '{title}',
name: 'menu_list', // add this property to get the reference
data: [{
title: 'Menu item 1'
}, {
title: 'Menu item 2'
},
{
title: 'Menu item 3'
}, {
title: 'Menu item 4'
}]
}
Add the control in the controller:-
Ext.define( 'Pear.controller.Main', {
extend:'Ext.app.Controller',
config:{
refs: {
menuList : "list[name='menu_list']"
},
control: {
menuList : {
itemtap: function(list,index,target,record){
console.log("Option 2 Tapped");
}
}
}
}
});
I have added two buttons to my container and now tap on list items not working.Please help.
Code
Ext.define('X.SelectCategories', {
extend: 'Ext.Container',
xtype: 'selectcategorypanel',
id: 'SelectCategories',
requires:[
],
initialize:function(){
this.callParent();
jsonObject = Ext.create('Tablet').make_webservice_call('get_categories');
Ext.getCmp('select_category_list').setData(jsonObject.info);
console.log(jsonObject.info);
//this.getNavigationBar.hide();
},
config: {
//title : 'Select Categories',
//iconCls: 'team',
//styleHtmlContent: true,
// scrollable: true,
layout: {
type: 'fit'
},
items: [
{
//fullscreen: true,
mode: 'MULTI',
/*
layout: {
type: 'fit'
},
*/
//title:'Select Categories',
xtype: 'list',
itemTpl: '{name}',
autoLoad: true,
id:'select_category_list',
store: {
fields: ['name','title']
}
},
{
xtype: 'container',
//fullscreen: true,
layout: {
type: 'vbox'
},
flex : 1,
layout: {
type : 'hbox',
align: 'bottom'
},
defaults: {
xtype : 'button',
flex : 1,
margin: 10
},
items: [
{ui: 'round',ui:"confirm" ,text: 'Save',id: 'categorysaveButton'},
{ui: 'round', ui:"decline" ,text: 'Reset',id: 'categoryresetButton'}
]
}
]
}
})
Try extend Navigationview extend: 'Ext.navigation.View',
I am using extjs grid and want to store the order and width of the columns for the users.
I have added:
var dateExpires = new Date().getTime()+(1000*60*60*24*300);
Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
expires: new Date(dateExpires) //300 days from now
}));
Now is the order of the columns stored but still missing the size for the columns. I don't use forcefit because i saw that could be an issue.
This is how a column look like
{
xtype: 'gridpanel',
id: 'GridPanel',
titleCollapse: false,
store: 'gridStore',
stateId: 'gridPanelState',
region: 'center',
viewConfig: {},
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'vehicle',
text: 'Vehicle'
},
{
xtype: 'gridcolumn',
dataIndex: 'speed',
text: 'Speed'
},
{
xtype: 'gridcolumn',
dataIndex: 'routeId',
text: 'RouteId'
},
{
xtype: 'gridcolumn',
dataIndex: 'direction',
text: 'Direction'
},
{
xtype: 'gridcolumn',
dataIndex: 'description',
text: 'Description'
}
],
I'm trying to write simple view with list on container but i have some problems.
First of all, the List is not visible when I'm trying to do it like this:
Ext.define('App.view.News', {
extend: 'Ext.Container',
but when it's written like this:
Ext.define('App.view.News', {
extend: 'Ext.navigation.View',
it works.
The problem is that when I write it with extend of navigation.View, im getting two toolbars on top and I can't find solution to disable the second one (added by the list).
Full code:
Ext.define('App.view.News', {
extend: 'Ext.Container', //Ext.navigation.View
xtype: 'news',
requires: [
'Ext.dataview.List',
'Ext.data.proxy.JsonP',
'Ext.data.Store'
],
config: {
style: ' background-color:white;',
items:
[
{
xtype: 'toolbar',
docked: 'top',
title: 'News',
minHeight: '60px',
items: [
{
ui: 'back',
xtype: 'button',
id: 'backButton',
text: 'Back',
},
{
minHeight: '60px',
right: '5px',
html: ['<img src="resources/images/Image.png"/ style="height: 100%; ">',].join(""),
},
],
},
{
xtype: 'list',
itemTpl: '{title},{author}',
store: {
autoLoad: true,
fields : ['title', 'author'],
proxy: {
type: 'jsonp',
url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://feeds.feedburner.com/SenchaBlog',
reader: {
type: 'json',
rootProperty: 'responseData.feed.entries'
}
}
}
}
]
}
});
Help please!
You need to give your container a layout and your list a flex property. The flex is important on lists as they don't have a viewable height since they scroll. I added a couple properties to your code below. Hope this helps.
Ext.define('App.view.News', {
extend: 'Ext.Container', //Ext.navigation.View
xtype: 'news',
requires: [
'Ext.dataview.List',
'Ext.data.proxy.JsonP',
'Ext.data.Store'
],
config: {
style: ' background-color:white;',
layout: 'vbox', // add a layout
items:
[
{
xtype: 'toolbar',
docked: 'top',
title: 'News',
minHeight: '60px',
items: [
{
ui: 'back',
xtype: 'button',
id: 'backButton',
text: 'Back',
},
{
minHeight: '60px',
right: '5px',
html: ['<img src="resources/images/Image.png"/ style="height: 100%; ">',].join(""),
},
],
},
{
xtype: 'list',
itemTpl: '{title},{author}',
flex: 1, // add a flex property
store: {
autoLoad: true,
fields : ['title', 'author'],
proxy: {
type: 'jsonp',
url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://feeds.feedburner.com/SenchaBlog',
reader: {
type: 'json',
rootProperty: 'responseData.feed.entries'
}
}
}
}
]
}
});