Results 1 to 2 of 2

Thread: [Solved]Adding a new element to Database driven ComboBox

  1. #1

    Default [Solved]Adding a new element to Database driven ComboBox

    I have three linked combobox on my form panel. I want to add one extra option to the last combo boxes for user to select.

    I have tried following but it dose not seems to work(following code is under listners->selectionchange of 2nd combo):

    Code:
    a=Ext.getCmp('cmbrname').getValue(); //GET PARENT COMBO SLECTION VALUE 
    var devicecombo = Ext.getCmp('idcombo'); //GET 3RD(CHILD) COMBO BOX BY ITS ID
    devicecombo.store.reload({params:{id1: a}}); //RELOAD THE BASED ON PARENT COMBO SELECTION
    MyRecordType = Ext.data.Record.create(['deviceID', 'deviceName']);  // CREATE NEW RECORD TYPE
    myrec = new MyRecordType({"deviceID":"100", "deviceName":"NO PATCHING DEVICE"}); // CREATE NEW RECORD
    devicecombo.store..add(myrec);  //ADD NEW RECORD
    Following is the JSON Response of the store reload:
    {rows:[{"deviceID":"2","deviceName":"ODF1"},{"deviceID":"3","deviceName":"ODF2"},{"deviceID":"4","deviceName":"ODF3"}]}


    Can anyone help me through this.


    Thanks and Best regards,
    Last edited by rehanazher; 11 Aug 2009 at 6:32 AM. Reason: Provding JSON response on Storer reload

  2. #2

    Default

    I got it thanks all for viewed:

    i moved my following code :
    Code:
        MyRecordType = Ext.data.Record.create(['deviceID', 'deviceName']);
            myrec = new MyRecordType({"deviceID":"100", "deviceName":"NO PATCHING DEVICE"});
            var devicecombo = Ext.getCmp('idcombo');
            devicecombo.store.add(myrec);
    to:

    Code:
    dsDeviceByRackID.on("load", function() {  
            MyRecordType = Ext.data.Record.create(['deviceID', 'deviceName']);
            myrec = new MyRecordType({"deviceID":"100", "deviceName":"NO PATCHING DEVICE"});
            var devicecombo = Ext.getCmp('idcombo');
            devicecombo.store.add(myrec);
        });

Posting Permissions

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