PDA

View Full Version : How to map button toggle groups automatically to specific field in form record



stahlman
20 Nov 2014, 12:13 PM
I have a set of toggle buttons in a single "toggleGroup" within a form. Conceptually, all 3 buttons correspond to a single "alignment" field in the model backing the form. Thus, I'd like a value corresponding to the pressed button to (i.e., "left", "center" or "right") to be associated with the Model field automatically when the button is pressed. Is this possible? I realize I could put code in the toggle button handler that puts the appropriate value in the single model field, but it seems that this is a common enough situation that there would be an automatic way to accomplish it...

Thanks,
Brett S.

slemmon
21 Nov 2014, 3:42 PM
Hi,

You can listen to the toggle event from all buttons in the group like in the example below:

dqr

stahlman
21 Nov 2014, 3:52 PM
Hi,

You can listen to the toggle event from all buttons in the group like in the example below:

dqr

Thanks. Yes. I knew I could set the field manually in the toggle handler, but I was hoping for something more along the lines of "inputValue" for Radio button groups.

Thanks,
Brett S.

carol.ext
24 Nov 2014, 1:02 PM
Brett, I am not sure I am following what you were looking for, but Ext JS 5.x has data binding. That might do what you are looking for.