1. #1
    Touch Premium Member lylepratt's Avatar
    Join Date
    Dec 2010
    Location
    Austin, Texas
    Posts
    144
    Vote Rating
    0
    lylepratt is on a distinguished road

      0  

    Default Problems setting initial selectitem value

    Problems setting initial selectitem value


    I'm having trouble setting the initial value of a selectitem. I've noticed some bugs related to this that are marked as fixed, but I still can not get it to work correctly. I've also tried some work arounds which have been unsuccessful.

    Here's some code that I think should work:

    Code:
        //I'm initializing a container here that has an empty panel I'm adding to at thisItem.items.get(1)
        initialize: function() {
            this.callParent();
            var thisItem = this;
            var options = this.options;
            var selectoptions = [];
            Ext.each(template.items, function(section, index) {
                selectoptions[index] = {};
                selectoptions[index]["text"] = section.label;
                selectoptions[index]["value"] = toString(section.index);
            });
    
            Ext.each(options, function(option, index) {
                thisItem.items.get(1).add(
                    {
                        cls: "gather_option",
                        items: [
                            {
                                xtype: "textfield",
                                label: "Code",
                                placeHolder: "The code to enter.",
                                value: option.digits,
                            },
                            {
                                xtype: "selectfield",
                                label: "Section",
                                value: "2",    //This is the value of one of the items in selectoptions
                                options: selectoptions
                            }
                        ]
                    }
                );
            });
        }

    If anyone has any other suggestions I'm open ears. I'd rather not wait till a new PR version is released to get this working.

    Thanks!
    Twitter: lylepratt

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,641
    Vote Rating
    434
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    This is an open bug... don't kill me
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Touch Premium Member lylepratt's Avatar
    Join Date
    Dec 2010
    Location
    Austin, Texas
    Posts
    144
    Vote Rating
    0
    lylepratt is on a distinguished road

      0  

    Default


    Ok. Glad its on the radar!
    Twitter: lylepratt