gpt4 book ai didi

javascript - ExtJS 4 TreePanel 自动加载

转载 作者:数据小太阳 更新时间:2023-10-29 05:03:05 25 4
gpt4 key购买 nike

我有一个 Ext.tree.Panel,它有一个 TreeStore。这棵树在一个选项卡中。问题是,当我的应用程序加载应用程序中使用的所有树时,即使存储在 autoLoad: false 上,也会加载它们的数据。

如何防止在树上自动加载?

Ext.define('...', {
extend: 'Ext.container.Container',
alias: 'widget.listcontainer',
layout: {
type: 'vbox',
align: 'stretch'
},
items: [{
xtype: 'container',
html: "...",
border: 0
}, {
xtype: '...',
flex: 1,
bodyPadding: 5,
margin: '9 0 0 0'
}]
});

Ext.define('...', {
extend: 'Ext.data.TreeStore',
model: '...',
proxy: {
type: 'ajax',
reader: {
type: 'json',
root: 'data'
},
api: {
read: 'some url'
}
}
});

Ext.define('...', {
extend: 'Ext.tree.Panel',
alias: 'widget....',
id: '...',
title: '...',

height: 400,
collapsible: true,
useArrows: true,
rootVisible: false,
multiSelect: true,
singleExpand: true,
autoScroll: true,
store: '...',

columns: [...]
});

附言我发现如果我在树上将 rootVisible 更改为 true 这个问题不会发生,但它会显示给根节点(我不想要)。

最佳答案

我遇到了同样的问题,为了避免隐式请求,我在 TreeStore 的配置中指定了一个 root 内联,例如:

Ext.create('Ext.data.TreeStore', {
model: '...',
proxy: {
type: 'ajax',
reader: {
type: 'json',
root: 'data'
},
api: {
read : 'some url'
}
folderSort: true,
rootVisible: false,
root: {expanded: true, text: "", "data": []} // <- Inline root
});

在显式 .load 之后,内联根被覆盖。

关于javascript - ExtJS 4 TreePanel 自动加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6843864/

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