我有一个可根据需要从Web Rest API加载的treepanel。其余的api将根据所选节点的ID返回包含数据的数组。这是代码:
In [31]: from mpl_toolkits.mplot3d import Axes3D
...: import matplotlib.pyplot as plt
...: from matplotlib import cm
...: from matplotlib.ticker import LinearLocator, FormatStrFormatter
...: import numpy as np
...: import math as mt
...:
...: fig = plt.figure()
...: ax = fig.gca(projection='3d')
...:
...: # Make data.
...: X = np.linspace(-5, 5, 6)
...: Y = np.linspace(-5, 5, 6)
...: Z = np.linspace(-5, 5, 6)
...: X, Y, Z = np.meshgrid(X, Y, Z)
...: # Plot the surface.
...: t = Z
...: ax.scatter3D(X, Y, Z, c=t.flatten())
感谢norbeq允许我更改第二家商店的ID。事情是树被很好地填充并且节点被扩展了,但是(为什么总是有一个but?)接着扩展节点上没有itemdblclick: function(item, record, eOpts) {
var store = Ext.getStore('mystore');
var newStore = Ext.create('mystore', {
autoDestroy: true,
storeId: 'otherId'
});
var parentid = record.data.id;
var that = this;
newStore.proxy.extraParams = {...};
newStore.autoDestroy = true;
newStore.storeId = 'otherId';
newStore.load({
callback: function(items) {
var node = store.getRootNode().findChild('id', record.data.idelement, true);
for (var i = 0, l = items.length; i < l; i++) {
var item = items[i].data;
var child = {..., idparent: parentid};
var newnode = node.createNode(child);
node.appendChild(newnode, true);
}
node.expand();
}
});
}
,-
保持不变。
这是我的意思:
我用红色围住了+
标记,并且该文件夹仍处于关闭状态。
此外,如果我单击+
符号,就会发生这种情况:
我该如何解决?
答案 0 :(得分:0)
好吧,最后我不得不说extjs官方文档对我来说很差。我通过测试找到了解决方案,并在多个论坛上阅读了很多文章。我找到了一种可能对其他人有用的解决方案:
var rootNode = store.getRootNode();
for (var i = 0, l = records.length; i < l; i++) {
var x = records[i].data;
var child = { ... };
if (!child.idparent) {
rootNode.appendChild(child);
} else {
var parent = rootNode.findChild('idelement', child.idparent, true);
parent.appendChild(child);
}
if (!child.leaf) {
var node = store.findNode('idelement', child.idelement);
node.set('expanded', true);
}
}
rootNode.set('expanded', true);
就这样