Extjs 如何将参数传递到视图对应的存储?
我的看法是:Extjs 如何将参数传递到视图对应的存储?,extjs,Extjs,我的看法是: Ext.define('Example.demo..Structure', { extend: 'Ext.tree.Panel', xtype: 'structure', height:700, title: 'Files', rootVisible: false, layout :{ type: 'vbox', pack: 'start', align: 'stretch' }, in
Ext.define('Example.demo..Structure', {
extend: 'Ext.tree.Panel',
xtype: 'structure',
height:700,
title: 'Files',
rootVisible: false,
layout :{
type: 'vbox',
pack: 'start',
align: 'stretch'
},
initComponent: function() {
var tempName = this.param;
Ext.apply(this, {
store: new Ext.data.TreeStore({
model: Example.demo.Structure,
proxy: {
type: 'ajax',
url: 'data/main/content/source/folder/' + tempName,
method:'GET'
},
folderSort: true
}),
columns: [{
xtype: 'treecolumn', //this is so we know which column will show the tree
text: 'Files',
flex: 2,
sortable: true,
dataIndex: 'name'
}]
});
this.callParent();
}
});
在这里,我创建存储并在url中添加参数
我希望存储在其他位置,我应该将tempName变量传递给该存储文件,并将该存储包含在视图中
我应该怎么做?我这样做:
store.proxy.url = 'data/main/content/source/folder/' + tempName;
store.load(
{
callback: function (records, operation, success) {
if (success) {
tree.reconfigure(store);
}
}
}
);
我想你可以这样做…1.将存储放在单独的文件中2.使用requires 3.使用存储查找在上述文件中添加文件。使用存储查找获取该存储,并根据需要配置代理,然后加载存储。如果你可以通过小代码段建议,如何使用存储查找。这会有帮助的。