1. #1
    Ext User
    Join Date
    Apr 2007
    Posts
    35
    Vote Rating
    0
    allenyoung is on a distinguished road

      0  

    Default A few problems about ComboBox and Ajax, some settings just don't work.

    A few problems about ComboBox and Ajax, some settings just don't work.


    Hi all,

    I'm pretty new to Ext and am trying to use the ComboBox widget. I've read the examples and the api document, and I've created a simple CombBox. It's really a cool widget, but there are some problems that I cannot figure out.
    • "grow" option doesn't work for me. I tried to set it to be true, but the dropdown list and the input area itself just don't grow or shrink to its content.
    • How can I add some select options after the ComboBox is created? Say I have a ComboBox for selecting category of an article and a button beside the ComboBox to pop up a dialog for creating a new category if the author just cannot find a proper one. I supposed to create a new category according to the author's submit, add the new category to the ComboBox's dropdown list, and then set the selected value to the newly created one. I found there is a setValue method which can set the ComboBox's selected value, but I cannot found any method for adding new select options.

    On the other side, I have some problems with Ext.Ajax too. The biggest one is about the "success" config options. At first, I'd set it in this way:
    Code:
    Ext.Ajax.request({
        url: '/grades',
        params: Ext.Ajax.serializeForm('grade-form'),
        success: onSubmitGradeSuccess
    });
    
    onSubmitGradeSuccess: function(response, options) {
        gradeDialog.hide();
        // update the gradeComboBox
    }
    But it turns out that the "onSubmitGradeSuccess" function would never be called. Then I tried to write the code in the following way:
    Code:
    Ext.Ajax.request({
        url: '/grades',
        params: Ext.Ajax.serializeForm('grade-form'),
        success: function(response, options) { gradeDialog.hide() }
    });
    This time, it worked pretty well. But why can't I declare a separate function and refer to it?

    By the way, I'm using ext-1.1-beta in firefox 2.0.x and safari 2.0 on mac os x.

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    grow doesn't apply to a combo - it's documented in the code, but it doesn't look like it generated the api doc correctly - hopefully this is corrected in the next doc gen.

    You should be able to just add new records to the underlying store object, using store.add

    Are you sure your callback fn is in scope, using your first example?

  3. #3
    Sencha User MD's Avatar
    Join Date
    Mar 2007
    Posts
    178
    Vote Rating
    0
    MD is on a distinguished road

      0  

    Default


    It's still listed in the config options even in the latest 1.x

  4. #4
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    4
    Vote Rating
    0
    brian.moeskau is an unknown quantity at this point

      0  

    Default


    Thanks, this is fixed in SVN.