PDA

View Full Version : Dynamic data for combobox



DeepthiG
24 Aug 2009, 9:36 PM
Hi all,

In my grid iam displaying the module names and some other info.On clicking the add module button a form is displayed with some fields in that i want to display the combox with module names retrieving the data from database.

I made a ajax call to retrieve data and assigned the data to a global variable.In the module properties for data iam assigning that value. But it is not displaying.

As of now i have hardcoded which you see in the attached screenshot as well.

Nagadev
24 Aug 2009, 10:35 PM
/* Combo box object for types */
var combo = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
lazyRender:true,

store: new Ext.data.JsonStore({
id: 0,
root:'types', // Json root element from the server response
fields: [
{name:'value', mapping:'value'},
{name:'meaning', mapping:'meaning'},
],
url:contextPath+'/Expenses?xaction=getCodes' (http://extjs.com/forum/contextPath+'/Expenses?xaction=getCodes') /* this is your server url which retrieves data for your combo */
}),
valueField: 'value',
displayField: 'meaning'
});


have this combo object as the replacement of your combo