PDA

View Full Version : How can i load db data to the combobox?



gigas01
16 Jul 2012, 7:52 PM
Hello,



I have to load the list from the DB to the combobox.

But I'm a noob dev...Don't know what to start first :(

Can you help me with this? or is there are sample code related to this?

I made a VERY SIMPLE UI.

I just have to load the list from the db



var scheduleForm = new Ext.FormPanel({
frame: true, border: false, buttonAlign: 'center',
method: 'POST', id: 'frmRegister',url: BASE_URL + 'user/addAction',
bodyStyle: 'padding:10px 10px 15px 15px;background:#dfe8f6;',
width: 400, labelWidth: 150,
items: [
{
xtype:'combo',
fieldLabel:'Company List',
id: 'companyList'
},
{
xtype:'combo',
fieldLabel:'Activity List',
id: 'activityList'
}]});

sword-it
16 Jul 2012, 10:11 PM
Hi,

You can try following code :-




var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
url:'combo.aspx' // path of your server data
});


Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
displayField: 'name',
valueField: 'abbr',
renderTo: Ext.getBody()
});