PDA

View Full Version : Adding a string to a combo box



derektrumbo
15 Jun 2010, 8:43 PM
Hi, I'm trying to simply add a text string to a combo box and am getting very confused by the API documentation regarding Stores, Records, and ArrayReaders. What I want is a combo box that just holds user names and can be added to with the click of a button.



var pplStore = new Ext.data.ArrayStore({
fields: ['userId'] // ArrayStore initially empty.
});
...
// Combo box definition, placed somewhere on the page
{
xtype: 'combo',
store: pplStore,
displayField: 'userId',
mode: 'local',
id: 'cboSearchType',
name: 'cboSearchType',
editable: false,
triggerAction: 'all',
selectOnFocus:true,
emptyText:'None Added',
allowBlank: true,
fieldLabel: "Search Type",
anchor: '95%'
}
...
function addUserName(userName) {
// What goes here? I know that ArrayStore has an add function but
// I cannot figure out how to properly construct the Record objects
// unfortunately (I have read all the docs already).
}
...
// Called by some user event on the page.
addUserName("ScoobyDoo");


Thanks so much for any help you can provide!

Derek

Animal
16 Jun 2010, 11:45 PM
ComboBoxes are not part of Ext Core.

Moving thread...

Nesta
17 Jun 2010, 1:11 AM
http://www.sencha.com/deploy/dev/docs/?class=Ext.data.Store
public Properties - recordType