1. #1
    Ext User
    Join Date
    Aug 2009
    Posts
    20
    Vote Rating
    0
    salih is on a distinguished road

      0  

    Default Setting Value into combobox on screen load

    Setting Value into combobox on screen load


    Hi...

    I have a combo ,templateName .I would like to initialize its value on screen load.
    We tried the script below.But its showing script error.(this.el.dom is null or not an object)

    Any help??

    var templateName = new Ext.form.ComboBox({
    id:'templateName',
    fieldLabel : 'Template Code',
    width : 130,
    store:templateStore,
    editable: false,
    displayField : 'templateCode',
    msgTarget:'side',
    typeAhead : true,
    allowBlank : true,
    valueField:'templateId',
    mode : 'local',
    triggerAction : 'all',
    emptyText : 'Please Select...'
    });

    if(templateName1 != null){
    templateName.setValue(templateName1);
    templateName.setRawValue(templateId1);

    }

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You can't call setRawValue on an unrendered combobox.

    You should be using the 'value' and 'hiddenValue' config options instead.

  3. #3
    Ext User
    Join Date
    Aug 2009
    Posts
    20
    Vote Rating
    0
    salih is on a distinguished road

      0  

    Default


    could you give me the script.

    Actually my requirement is to set the template name & Id value into the combo after submitting the form value to the server.

    The below script is not working

    templateName.value=templateName1;
    templateName.hiddenValue=templateId1;

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Code:
    if (templateName.rendered) {
      templateName.setValue(templateId1);
      templateName.setRawValue(templateName1);
    } else {
      templateName.hiddenValue = templateId1;
      templateName.value = templateName1;
    }

  5. #5
    Ext User
    Join Date
    Aug 2010
    Posts
    1
    Vote Rating
    0
    shafnashibu is on a distinguished road

      0  

    Default


    templateName.setValue(val);
    Here val is the value from templateStore that you have to set in combo.

  6. #6
    Ext User
    Join Date
    Aug 2009
    Posts
    20
    Vote Rating
    0
    salih is on a distinguished road

      0  

    Default


    Thanks Condor,Issue resolved

Similar Threads

  1. Need help with setting parameter for comboBox load
    By catacaustic in forum Ext GWT: Help & Discussion (1.x)
    Replies: 1
    Last Post: 14 May 2009, 3:36 PM
  2. Setting Combobox with form.load() ?
    By Bucs in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 17 Apr 2009, 7:03 AM
  3. Setting Ext.Ajax.Request Loading Screen
    By RyanZec in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 28 Oct 2008, 8:38 AM
  4. Combo Box Slowing down screen load
    By nrajesh in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 6 Nov 2007, 10:14 AM
  5. Let Store.load wait for results, setting (ComboBox) display values in grid
    By lvanderree in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 14 Oct 2007, 4:00 PM

Thread Participants: 2