PDA

View Full Version : Populate data from a grid to a form



defcon1
20 Jun 2010, 4:43 AM
Hi,

regarding to this example: http://www.sencha.com/deploy/dev/examples/form/form-grid.html

In this example data is populated to a form. Is there a way to populate to a combobox (1.) and
a radio-button which is not in a radiogroup (2.)?

1.: Have no idea how to fill a combo box ....

2.: If a radio button is not in a group, the radio button is getting marked but not
de-marked.

Someone an idea?

Many thanks ....
d1 :)

defcon1
21 Jun 2010, 7:09 AM
No one ever did this?

Condor
21 Jun 2010, 7:15 AM
1. Look at some combobox examples.
2. Your data will need to contain idOfRadio:true/false instead of nameOfRadio:valueOfRadio.

defcon1
23 Jun 2010, 4:54 AM
As far as I can see the "name" field (display) and the "hiddenName" field (value) have to match two entries in the grid.

Is there a way that only only the hiddenName has got to match? Itīs because in the combo box I want to display a different text as I got in the grid? The relation should be the value, not the displayname!?

Many thanks!
d1 ;)

Condor
23 Jun 2010, 5:03 AM
Your grid only needs to contain the value. Use a combocolumn (see feature request section) to display the corresponding text in the grid and combobox editor.

defcon1
23 Jun 2010, 7:59 AM
I am not sure if thatīs what I need ... :-?

The combobox always shows the 'hiddenName' value as option, and this is my unique number instead of my display name.


Short explanation:

I have a grid and a store with some entries, and a unique number. Then I have a ComboBox in a form with its own store, also containing this unique number.

Now if I click an entry in the grid, the combobox should show a field in the record (combobox store) containing this unique number.

Puuh, hopefully someone understands this ....

darthwes
23 Jun 2010, 1:57 PM
so when the grid's selection model fires the selected event call combo.setValue('whatever') ?

Oh that problem, you look up it's index in the combo's store and then set it. Like if I had x = 4, I want to select the record where x =4 even though the display name for the combo is something like y. I would loop over the combo's store and find where X=4 and then i'd grab the Y and call setValue. You might be also able to use setRawValue...

defcon1
24 Jun 2010, 4:28 AM
Sorry guys, it was my fault.

I did set the store for the combo box to mode:'remote' ... and so the combo box hasnīt loaded the data and that resulted in showing the Id of the grid. As soon as I did load the data by clicking the trigger, it worked.

Many thanks!
d1