繁体   English   中英

ExtJs组合框问题

[英]ExtJs Combobox problem

嗨,我有一个带有远程组合框的formpanel,商店是jsonstore,并且是从带有分页结果的webservices获取的,一切都很好,但是当您从组合中选择一个选项时,总是选择第一个,您可以选择第三个,但是组合选择第一个选项我不知道其原因,该组合的配置是这样的:

{
                            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']
        });

谢谢

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM