簡體   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