Results 1 to 2 of 2

Thread: ComboBox

  1. #1

    Default ComboBox

    Hi People,
    Sorry for asking this question.Many of you might feel this question has been repeated
    but it is slightly diff .
    My question is related to combobox hiddenName property.My problem is I want to display the name attribute but submit valuefield.So i used hidden Name stuff.It works fine I mean it submits my value field but i dont know somehow my displayfield doesnt seem to be displayed.It displayes if i comment the hidenName but i need to submit value field.Also i can see the display field to be rendered as json but not displayed.
    My code snippet:
    Code:
                                                 xtype : 'combo',
                                                fieldLabel : 'CpsServer',
                                                name : 'cpsServer',
                                                 allowBlank:false,
                                                 hiddenName:'cpsID',
                                                 store: cpsServerStore,
                                                 displayField:'NAME',
                                                 valueField:'ID',
                                                 editable:true,
                                                 typeAhead:true,
                                                 mode:'remote',
                                                 triggerAction:'all',
                                                 width:300,
                                                 autoScroll:true,
                                                 selected:name,
    
    reader:
    var cpsServerStore = new Ext.data.Store({
            autoLoad:true,
            proxy:new Ext.data.HttpProxy({
                url:baseUrl+"/query/getCpsServerNames"
            }),
             reader:new Ext.data.JsonReader({
                  root:'items',
                  fields:[
                          {name:'ID'},
                          {name:'NAME'}
                          ]
                  
              })
            
        })
    
    
    form REader where mapping is there to database
                                               var reader = new Ext.data.JsonReader({
            root : 'result',
            fields : [ {
                name : 'id',
                mapping : 'subscription.id'
            }, {
                name : 'cpsServer',
                mapping : 'cpsServer.name'
                
            }, {
                name : 'description',
                mapping : 'subscription.description'
            }, {
                name : 'subscriberApplication',
                mapping : 'subscriberApplication.name'
                
                
            }, {
                name : 'outputQueue',
                mapping:'outputQueue.name'
            
            }, {
                name : 'enabled',
                mapping : 'subscription.enabled'
            }, /*
                 * { name : 'messageFormat', mapping :
                 * 'subscription.messageFormat.name' },
                 */ {
                name : 'topic',
                mapping : 'subscription.topic'
            }, {
                name : 'filter',
                mapping : 'subscription.filter':((
            }
    
            ]
        });
    Last edited by [email protected]; 14 Apr 2010 at 6:44 AM. Reason: USE [CODE][/CODE] tags

  2. #2

    Default

    Hello Friends,
    I have found the solution.
    I am posting my code along with explanation which might be help to someone.
    xtype : 'combo',
    fieldLabel : 'CpsServer',
    //name:'cpsServer',
    dataIndex:'cpsServer',
    hiddenName:'cpsID',
    store: cpsServerStore,
    displayField:'NAME',
    valueField:'ID',
    editable:false,
    mode:'remote',
    triggerAction:'all',
    width:300,
    autoScroll:true,
    selected:name

    If you use both name and hiddenName the hiddenName is overriden so at display time the displayField doent seeems to appear
    to have a work around instead of using name use dataIndex to map to your formpanel reader while dispalyField to map remote source in case of remote combobox.
    Hope this helps

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •