PDA

View Full Version : Problems setting initial selectitem value



lylepratt
13 Jan 2012, 9:12 AM
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:



//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!

mitchellsimoens
13 Jan 2012, 9:54 AM
This is an open bug... don't kill me :)

lylepratt
13 Jan 2012, 11:12 AM
Ok. Glad its on the radar!