gpt4 book ai didi

javascript - 布局运行失败

转载 作者:行者123 更新时间:2023-11-30 07:58:52 26 4
gpt4 key购买 nike

每当我尝试设置布局类型覆盖时,我都会遇到布局运行失败,但我不确定是什么原因导致的。

我有一个父 View ,它有一个选项卡面板作为子项:

Ext.define('InventoryDemo.view.main.Main', {
extend: 'Ext.panel.Panel',
xtype: 'app-main',

requires: [
'Ext.plugin.Viewport',
'InventoryDemo.view.brand.Brand'
],

title: '<h1>Inventory Demo</h1>',
layout: 'border',

items:[
{
...
},
// This is the tab panel that I'm trying to add the container class to
{
xtype: 'tabpanel',
title: 'Inventories',
header: false,
region: 'center',
reference: 'inventoryTabSet'
}
]
});

这是我试图作为选项卡添加到选项卡面板的 View :

Ext.define("InventoryDemo.view.inventory.list.Inventory",{
extend: "Ext.container.Container",
xtype: 'inventory',

...

closable: true,
layout:{
type: 'hbox',
align: 'stretch'
},
items:[
{
xtype: 'grid',
bind:{
store: '{inventory}'
},

listeners:{
itemclick: 'showDetails'
},

columns:[
{ text: 'Name', dataIndex: 'name', flex: 1 },
{ text: 'Price', dataIndex: 'price' },
{ text: 'Active', dataIndex: 'active' },
]
}
]
});

如果我不包含布局配置,这会起作用:

    layout:{
type: 'hbox',
align: 'stretch'
},

如果遗漏了, View 加载没有问题,但是当我包含 hbox 类型时,我运行失败。

我试着查看调用堆栈,但老实说,我仍然需要 sencha 来查看导致错误的原因:

[E] Layout run failedlog @ ext-all-rtl-debug.js?_dc=1444523987794:8732logx @ ext-all-rtl-debug.js?_dc=1444523987794:8768Ext.apply.log.log.error @ ext-all-rtl-debug.js?_dc=1444523987794:8771Ext.define.handleFailure @ ext-all-rtl-debug.js?_dc=1444523987794:214144Ext.define.runComplete @ ext-all-rtl-debug.js?_dc=1444523987794:214616callOverrideParent @ ext-all-rtl-debug.js?_dc=1444523987794:1348Ext.Base.Base.addMembers.callParent @ ext-all-rtl-debug.js?_dc=1444523987794:11711Ext.override.runComplete @ ext-all-rtl-debug.js?_dc=1444523987794:61413Ext.define.run @ ext-all-rtl-debug.js?_dc=1444523987794:214610Ext.define.statics.flushLayouts @ ext-all-rtl-debug.js?_dc=1444523987794:61421Ext.define.statics.resumeLayouts @ ext-all-rtl-debug.js?_dc=1444523987794:61436Ext.resumeLayouts @ ext-all-rtl-debug.js?_dc=1444523987794:66954Ext.define.notify @ ext-all-rtl-debug.js?_dc=1444523987794:92658Ext.define.onTick @ ext-all-rtl-debug.js?_dc=1444523987794:92677(anonymous function) @ ext-all-rtl-debug.js?_dc=1444523987794:6416(anonymous function) @ ext-all-rtl-debug.js?_dc=1444523987794:6606 3ext-all-rtl-debug.js?_dc=1444523987794:8732 [E] Layout run failedlog @ ext-all-rtl-debug.js?_dc=1444523987794:8732logx @ ext-all-rtl-debug.js?_dc=1444523987794:8768Ext.apply.log.log.error @ ext-all-rtl-debug.js?_dc=1444523987794:8771Ext.define.handleFailure @ ext-all-rtl-debug.js?_dc=1444523987794:214144Ext.define.runComplete @ ext-all-rtl-debug.js?_dc=1444523987794:214616callOverrideParent @ ext-all-rtl-debug.js?_dc=1444523987794:1348Ext.Base.Base.addMembers.callParent @ ext-all-rtl-debug.js?_dc=1444523987794:11711Ext.override.runComplete @ ext-all-rtl-debug.js?_dc=1444523987794:61413Ext.define.run @ ext-all-rtl-debug.js?_dc=1444523987794:214610Ext.define.statics.flushLayouts @ ext-all-rtl-debug.js?_dc=1444523987794:61421Ext.define.statics.resumeLayouts @ ext-all-rtl-debug.js?_dc=1444523987794:61436Ext.resumeLayouts @ ext-all-rtl-debug.js?_dc=1444523987794:66954privates.statics.notify @ ext-all-rtl-debug.js?_dc=1444523987794:116731privates.statics.onTimer @ ext-all-rtl-debug.js?_dc=1444523987794:116750Ext.Function.fireHandlers @ ext-all-rtl-debug.js?_dc=1444523987794:6303

在尝试使用除默认布局类型以外的任何布局类型时,我如何设置 View 会导致失败?

最佳答案

当容器的布局设置为 hbox 时,该容器的子容器应具有 flexwidth。如果您为grid指定flexwidth,那么您将不会面临布局运行失败。

这是给你的 fiddle : https://fiddle.sencha.com/#fiddle/v9a

关于javascript - 布局运行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33060491/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com