Results 1 to 7 of 7

Thread: Default Combobox value not selected

  1. #1
    Sencha User
    Join Date
    Oct 2013
    Posts
    200
    Answers
    3

    Default Answered: Default Combobox value not selected

    Hi,

    I have been trying to set a combobox value by default when the combox renders on the page.
    before that i am loading data in the combobox store.
    combo.store.loadData(data);
    combo.setValue(value) // value is a code value from the store only

    In combox configuration i have selected queryMode : local.

    I am not sure why combobox is not getting rendered with the value i am specifying, data is loading properly.

    I got the issue as it is working when i called the setValue method on some event, but can anyone please tell me that is there any callback for loadData method ??
    or how can i make it in sync, i am using loadData method because the store is without any proxy and reader i am just filling the data in the store and binding it to the combobox.



    Please help !!

    Thanks in advance
    Ankit

  2. loadData is not async (or it shouldn't be), only remote store load is. There must be something else wrong. Try to set the value from console.

  3. #2
    Sencha User
    Join Date
    Mar 2011
    Location
    Hyderabad
    Posts
    106
    Answers
    10

    Default

    Have you declared the valueField and displayField config option in combobox. Check the below example, it is working fine in my end
    Attached Images Attached Images

  4. #3
    Sencha User
    Join Date
    Oct 2013
    Posts
    200
    Answers
    3

    Default

    Yes, I have declared Value and display field property.
    I have a master store having values of multiple comboboxes and in success load of that i am loading the data into a local store and then setting the value. but its not happening.

    Ext.getStore('masterStore').load({

    callback: function (records,options, success)
    {
    if(success)
    {
    var combo = Ext.getCmp('comboId');
    combo.store.loadData(records.raw.xyz)
    // till this point its working fine, data is getting loaded into respective combo box
    combo.setValue(Value);
    // the value is correct

    }
    }
    });

    So this is the issue, somehow its not going into sync.

    Please help !!

  5. #4
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Answers
    512

    Default

    Check first if Value can be found in the combo store.

    The easiest way is to set value:Value config option on the combo - you can try that.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  6. #5
    Sencha User
    Join Date
    Oct 2013
    Posts
    200
    Answers
    3

    Default

    Yes, i have checked that value is there.

    The problem may be the combo store is not having all the values when the .setValue got excecuted.

    Is loadData method works async ??

  7. #6
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Answers
    512

    Default

    loadData is not async (or it shouldn't be), only remote store load is. There must be something else wrong. Try to set the value from console.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  8. #7
    Sencha User
    Join Date
    Oct 2013
    Posts
    200
    Answers
    3

    Default

    Thanks for reply,

    i am not sure about the excact error, but now it is working after restructuring. i have just seprated out the functions.

    thanks

Posting Permissions

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