Description

Binding RadioGroup can be problematic because its value in the form of object: {name:value}. The problem is more pronounced if we want to bind radio group to model instance field and the field stores primitive values.

The solution is to use formulas to transform objects from radio groups to primitive values that can be stored in model fields and vice versa primitive values from fields to objects that can be consumed by radio groups.

Main Features

  • view model links config option loads one record from the server
  • the record servers as data source
  • formulas create gender view model property for binding to radio group
  • formulas implement the transformation logic between radio group and model instance (record)
  • record field gender is directly bound to the combo to show that the formulas logic works as expected

Use Cases

This approach is useful when a model field can contain only a couple of distinct values and we want the user to select one of them in a radio group.

Example Files (relative to example root)

The example has been initially generated with sencha generate app. The following list contains only relevant files:

app/view/MainModel.js
app/view/Main.js
If you want to see the example code, login or sign-up. Free membership is available.
Follow me:
Latest posts by saki (see all)

Enter your username and password to log into your account. Don't have an account? Sign up.

Want to collaborate on an upcoming project?