EXT combobox赋值

编程入门 行业动态 更新时间:2024-10-27 02:30:21

EXT combobox<a href=https://www.elefans.com/category/jswz/34/1769111.html style=赋值"/>

EXT combobox赋值

Ext.combobox对象在通过setValue赋值时,必须在combobox对象的store对象中存在该值,否则无法赋值。

事例:

{
                            xtype: 'fieldcontainer',
                            combineErrors: true,
                            msgTarget : 'side',
                            id:'module_container_id',
                            layout: 'hbox',
                            defaults: {
                                flex: 1,
                                allowBlank: false,
                                labelWidth : 90
                            },
                            items: [{
                                xtype  : 'textfield',
                                fieldLabel:'所属模块',
                                name:'module_name',
                                id:'module_name',
                                allowBlank : true,
                                maxLength:300
                            },{
                                xtype:'button',
                                id:'cpczscbtn',
                                text:'选择模块',
                                flex:0.3,
                                handler:function(){
                                    showBaselineSelector(coczscCallback,true);
                                }
                            }]
                        },


function coczscCallback(records){
             var name = '';
             var id = '';
             var module_version = '';
              Ext.Array.each(records,function(r){
                    name = name + r.data.module_name + r.data.module_version;
                        id = id + r.data.p_module_content_id;
                        module_version = r.data.module_version;
              });
              pBug_form.getForm().findField('module_name').setValue(name);
              pBug_form.getForm().findField('p_task_id').setValue(id);
              versionComboStore.add({text:module_version , value:module_version});
              Ext.getCmp('task_version1').setValue(module_version);
              pBug_form.getForm().findField('module_name').setReadOnly(true);
              
        }

var versionComboStore = Ext.create("Ext.data.Store",{
            fields: ['text', 'value'],
            proxy:{  //数据代理
                type: 'ajax',
                method: 'POST',
                reader: {//读取器
                    type: 'json'
                }
            },
            autoLoad:false
        });


更多推荐

EXT combobox赋值

本文发布于:2023-06-21 07:11:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/813728.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:赋值   EXT   combobox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!