extjs:如何在加载时设置组合框的值 [英] extjs: How to l set value for combobox when loading

查看:19
本文介绍了extjs:如何在加载时设置组合框的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 我正在寻找一个加载侦听器,当组合框启动时,加载将被调用并向服务器执行 ajax 以获取组合框的正确显示值.但是,从未调用加载函数.. 我该如何解决?

  1. I am looking for a load listener, that when the combobox is up, load will be called and preform an ajax to the server to take the correct display value for the combobox. But, load function is never called.. how can i fix it ?

我想在组合框之前显示一个文本,所以我添加了属性 fieldLabel: 'Save logs to:'.但是文字没有显示出来.

I want to display a text before the combobox, so i added the attribute fieldLabel: 'Save logs to:'. But the text is not displayed.

谢谢,尤尼

this.log_save_combo = new Ext.form.ComboBox
    ({
        store: ['Device', 'USB1', 'USB2']
        , id: 'cplogs_log_save_combo'
        , name: 'cplogs_log_save_combo'
        , triggerAction:'all'
        , fieldLabel: 'Save logs to:'
        , editable: false
        //, value: "Device"
        , listeners: {
                'load': function(){
                        alert("in load function");
              }
    });

推荐答案

没有用于组合的 load 事件.. 因此您编写的代码没有得到执行.您已经有一个用值定义的商店..您是否尝试将新值加载到附加到组合框的商店?组合框已启动"是什么意思?

There is no load event for a combo.. hence the code you wrote is not getting executed. You already have a store defined with values.. are you trying to load new values to the store that is attached to the combo box? What do you mean by "combobox is up"?

要从服务器加载带有值的组合框,您只需要加载商店.请参阅这篇文章,了解如何加载组合框.

To load a combo box with values from the server, you only need to load the store. Refer to this article on how to load the combobox.

----------------------------------------- 更新 ------------------------------------------

----------------------------------------- UPDATE -----------------------------------------

  1. 您是否正在尝试加载带有值的表单?在这种情况下,您可以使用 BasicFrom 提供的加载方法加载值.请参阅本示例.即使它使用 XML,您也可以轻松更改为从 JSON 加载数据.

  1. Are you trying to load a form with values? In that case you can load the values using the load method available with the BasicFrom. Refer to this example. Even though it uses XML you can easily change to load data from JSON.

为了显示标签字段,您需要将容器的布局属性设置为

In order to display label field, you need to set your layout property of your container as

布局:'表单'

这篇关于extjs:如何在加载时设置组合框的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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