【发布时间】:2019-06-04 17:37:29
【问题描述】:
在记录编辑窗口中,我需要使用树状选择器,为此,文件Ext.ux.TreePicker包含在app.js文件中,该文件位于与@同级的app文件夹中987654325@文件。
Ext.Loader.setConfig({enabled:true});
Ext.Loader.setPath('Ext.ux', 'app');
Ext.application({
extend: 'Ext.app.Application',
name: 'App',
appFolder: 'app',
requires: ['Ext.ux.TreePicker'],
...
在记录编辑窗口中,设置xtype: 'treepicker'字段:
Ext.define('App.view.OperationEdit', {
extend: 'Ext.window.Window',
xtype: 'operation-edit',
alias: 'widget.operationedit',
controller: 'operation_controller',
viewModel: {
type: 'operation_model'
},
defaults: {
xtype: 'textfield',
margin: 10,
labelAlign: 'top'
},
closable: true,
items: [{
xtype: 'form',
items: [
{
xtype: 'treepicker',
store: Ext.data.StoreManager.get('StorageStore'),
fieldLabel: "Mesto_hraneniya",
valueField: 'id',
displayField: 'text',
selectChildren: true,
canSelectFolders: true,
name: 'mesto_hraneniya'
},
......
当我打开编辑窗口时,我得到一个错误:
TypeError: p is undefined
示例链接Fiddle
为什么会出现错误?如何正确显示treepicker字段?
谢谢
【问题讨论】:
-
为什么不在 fiddle.sencha.com 分享一个小提琴,这样更容易帮助?
-
@abeyaz 我在问题的示例中添加了一个链接,但由于某种原因 TreePicker.js 文件不想连接。在本地应用程序中,发生文件连接。
-
您必须选中软件包列表底部的“ux”复选框才能使其正常工作。
-
@abeyaz 当我选中 Ux 框并打开记录进行编辑时,出现错误:
TypeError: item is undefined。 Treepicker 位于 app/view/TestEdit.js 编辑窗口中。添加或编辑记录时会打开此窗口 -
检查我的答案,我成功了。
标签: javascript extjs