【问题标题】:Extjs fieldLabel in Ext.tree.PanelExt.tree.Panel 中的 Extjs fieldLabel
【发布时间】:2019-07-15 09:21:41
【问题描述】:

我想在我的 Ext.tree.Panel 中的目录树之前有一个“欢迎文本”,所以是这样的:

我写了这段代码,但它不起作用:

Ext.define('MyProject.view.permissions.Example', {
    extend: 'Ext.tree.Panel',

    requires: [
        'MyProject.view.permissions.ExampleController'
    ],

    controller: 'example',
    xtype: 'exampleWindow',
    store: 'examplePermissionTree',
    rootVisible: false,
    rowLines: false,
    //headerPosition: 'left',
    lines: false,
    autoLoad: false,
    autoExpand: false,

    items :[{
           xtype: 'displayfield',
           fieldLabel: 'welcome text',
           name: 'welcome',
     }],

    columns: {
        items: [ {
                    xtype: 'treecolumn',
                    dataIndex: 'text',
                    flex: 1
                }, {
                    xtype: 'booleancolumn',
                    flex: 0.3,
                    dataIndex: 'granted',
                    trueText: Strings.permissionGranted,
                    falseText: Strings.permissionNotGranted
                }, {
                    xtype: 'widgetcolumn',
                    flex: 0.2,
                    widget: {
                        xtype: 'button',
                        handler: 'onGroupClick',
                        text: Strings.permissionGrant

                    }
                }
            ]
        }
});

我的问题是文本没有出现。它只显示目录树。 我该如何解决?我应该使用其他方法吗?

【问题讨论】:

    标签: javascript extjs textfield treepanel


    【解决方案1】:

    1.使用工具而不是项目

    使用tools 代替物品可以解决问题。要添加到标题工具区域的 Ext.panel.Tool 配置/实例数组。代码应该是这样的

    tools :[{
           xtype: 'displayfield',
           fieldLabel: 'welcome text',
           name: 'welcome',
          }],
    

    2。使用标签代替显示字段

         tools :[{
                xtype: 'label',
                fieldLabel: 'welcome text',
                name: 'welcome',
               }],
    

    【讨论】:

    • 非常感谢!!是否也可以不在标题中插入文本,而是在图像中插入文本?因为现在它出现在蓝色区域......或者是不可能的,我应该通过 CSS 修复它(我的意思是有白色背景,左对齐等)?
    猜你喜欢
    • 1970-01-01
    • 2011-06-21
    • 1970-01-01
    • 1970-01-01
    • 2016-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多