如何在飞行中添加字段的配置? [英] How to adding field's config on the fly?

查看:67
本文介绍了如何在飞行中添加字段的配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加allow Blanks的配置,当我点击我的树面板中的一个节点!
如果节点是一个叶子,我想放置名称字段的配置:allowBlank:false
,如果不是一个叶,allowBlank:true。
我没有找到方法来做到这一点?



非常感谢:)






感谢您的回答,但我的组合框不是全局变量:

  var monPrepanel = Ext.create('Ext.form.Panel',{

frame:true,
title:'Editing Zone',
// renderTo:'mesfields',
// width:750,
forceFit:true,

items:[{

xtype:'fieldset',
title:'添加任务:',
margin:'20 20 20 20',

collapsible:true,
defaultType:'textfield',
defaults:{anchor: 100%'},
layout:'anchor',
items:[{

itemId:'p0',
allowBlank:false,


xtype:'textfield',
anchor:'60%',

padding:'0 30 0 30',
fieldLabel:'Task',

name:'task'
},{

itemId:'p1',
allowBlank:false,


xtype:'combobox',
anchor:'40%',
store: materialstore,
queryMode:'local',
displayField:'data',
width:50,
valueField:'data',
editable:false,

填充:'0 30 0 30',
fieldLabel:'Material',

名称:'material'
},{

allowBlank:true,

xtype:'combobox',
anchor:'40%',
store:ccstore,
queryMode:'local'
displayField:'data',
width:50,
valueField:数据',
可编辑:false,

填充:'0 30 0 30',
fieldLabel:'CC',

名称:'cc '
}

我需要通过id访问组合框组件?
有解决方案可以将这个组件接收到项目中吗?

解决方案

设置 id 属性( id:'anyId'),并使用 Ext.apply(Ext.getCmp ('anyId'),{你的配置对象});


I want to adding allow Blanks 's config when i click on a node in my Tree Panel ! if node is a leaf , i want to put name field's config : allowBlank : false and if not a leaf , allowBlank : true . I don't find method to do this ?!

Thanks a lot :)


Thanks to your answer but my combobox is not a global variable :

var monPrepanel = Ext.create('Ext.form.Panel',{

        frame : true,
        title : 'Editing Zone',
        //renderTo : 'mesfields',
        //width : 750,
        forceFit : true,

        items: [{

                xtype:'fieldset',
                title: 'Add Task : ',
                margin : '20 20 20 20',

                collapsible: true,
                defaultType: 'textfield',
                defaults: {anchor: '100%'},
                layout: 'anchor',
                items: [ {

                itemId : 'p0',
                allowBlank : false,


         xtype : 'textfield',
    anchor : '60%',

         padding : '0 30 0 30',
          fieldLabel : 'Task',

          name : 'task'
        } , {

                itemId : 'p1',
                allowBlank : false,


         xtype : 'combobox',
            anchor : '40%',
            store : materialstore,
            queryMode: 'local',
            displayField: 'data',
            width : 50,
            valueField: 'data',
            editable : false,

         padding : '0 30 0 30',
          fieldLabel : 'Material',

          name : 'material'
        } , {

                allowBlank : true,

         xtype : 'combobox',
            anchor : '40%',
            store : ccstore,
            queryMode: 'local',
            displayField: 'data',
            width : 50,
            valueField: 'data',
            editable : false,

         padding : '0 30 0 30',
          fieldLabel : 'CC',

          name : 'cc'
        }

I need to access to the combobox component by id maybe ? There are solutions to acess to this component into items to items ?

解决方案

Set an id property for the desired combo box (id: 'anyId'), and use Ext.apply(Ext.getCmp('anyId'), {your config object});

这篇关于如何在飞行中添加字段的配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆