【问题标题】:ExtJs Combobox problemExtJs 组合框问题
【发布时间】:2011-11-25 08:48:42
【问题描述】:

嗨,我有一个带有远程组合框的表单面板,商店是 jsonstore,是从带有分页结果的 web 服务获取的,一切都很好,但是当你从组合中选择一个选项时,总是选择第一个,你可以选择第三个,但是组合选择第一个选项我不知道为什么组合的配置是这样的:

{
                            xtype: 'combo',
                            fieldLabel: 'Sitio Interés',
                            anchor: '100%',
                            triggerAction: 'all',
                            store: dsPuntos,
                            mode: 'remote',
                            displayField: "Nombre",
                            valueField: "Id",
                            typeAhead: false,
                            width: 222,
                            hideLabel: true,
                            allowBlank: false,
                            id: 'cboDato',
                            editable: true,
                            pageSize: 20,
                            minChars: 0,
                            hideTrigger: true,
                            //enableKeyEvents: true,
                            emptyText: 'Escriba un sitio de interés',
                            tpl: '<tpl for="."><div class="x-combo-list-item">{Nombre} - {Municipio}</div></tpl>',
                            listeners: {
                                scope: this,
                                specialkey: function (f, e) {
                                    if (e.getKey() == e.ENTER) {
                                        Ext.getCmp('btnConsultar').handler.call(Ext.getCmp('btnConsultar').scope);
                                    }
                                }
                            }
                        },

商店就在这里:

var dsPuntos = new Ext.data.JsonStore({
            proxy: new Ext.data.HttpProxy({
                url: 'Services/MapService.svc/GetSitiosInteres',
                method: 'GET'
            }),
            root: 'd.rows',
            totalProperty: 'd.total',
            id: 'Id',
            fields: ['Nombre', 'Municipio', 'Id']
        });

谢谢

【问题讨论】:

    标签: javascript asp.net autocomplete combobox extjs3


    【解决方案1】:

    您的商店配置有点偏离。它应该是idProperty 而不是id。还要检查来自服务器的json。确保 id 是唯一的。

    【讨论】:

      猜你喜欢
      • 2011-11-13
      • 2011-08-05
      • 2012-02-23
      • 2021-05-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-19
      • 2012-01-11
      • 1970-01-01
      相关资源
      最近更新 更多