PDA

View Full Version : Update Other Fields via Combobox selection?



shaoen01
4 Feb 2012, 8:05 AM
Hi All,

I am using a grid (using store1) with a combo box using store2. I would like to simulate such that when a user selects value1 in the combo box, the other fields in the row gets populated with information. Is it possible to initiate a postback on selection of combo box value and populate the rest of the fields?

Farish
4 Feb 2012, 9:57 AM
you can use the select event of the combobox:


{
xtype: 'combo',
store: store2,
listeners:
{
select: function(combo, records, eOpts) // records is an array of selected record
{
// determine value1, value2 based on records
store1.getAt(index of selected record).set({field1: value1, field2: value2});
}
}
}

shaoen01
4 Feb 2012, 4:17 PM
you can use the select event of the combobox:


{
xtype: 'combo',
store: store2,
listeners:
{
select: function(combo, records, eOpts) // records is an array of selected record
{
// determine value1, value2 based on records
store1.getAt(index of selected record).set({field1: value1, field2: value2});
}
}
}

Farish:
How do i do a postback to get the record based on the combo box selection? I would probably need to go back to database. Or should i use another store to store all the information and filter out the information?

store1.getAt(index of selected record) - Is it possible to filter the results in another store with the selected value from the combo box and retrieve the record?