Problem loading extjs radio source data

How do you upload data for a radio group to extjs to check the correct radio stations?

On the extjs radio / checkbox page you will find this code

{
  xtype: 'radiogroup',
  fieldLabel: 'Auto Layout',
  items: [
       {boxLabel: 'Item 1', name: 'rb-auto', inputValue: 1},
       {boxLabel: 'Item 2', name: 'rb-auto', inputValue: 2, checked: true},
       {boxLabel: 'Item 3', name: 'rb-auto', inputValue: 3},
       {boxLabel: 'Item 4', name: 'rb-auto', inputValue: 4},
       {boxLabel: 'Item 5', name: 'rb-auto', inputValue: 5}
   ]
 }

I would expect that executing form.load () with json like {'rb-auto': 3, …}would mark element 3 as noted. This does not work. How could you achieve this effect?

Answer: (Zach correctly applies to extjs 3.1) My expectation is true, but only since extjs 3.1 was released recently. In addition, you need to indicate the name on the individual elements of the radio as the group itself:

{
  xtype: 'radiogroup',
  fieldLabel: 'Auto Layout',
  name: 'rb-auto',
  items: [
       {boxLabel: 'Item 1', name: 'rb-auto', inputValue: 1},
       {boxLabel: 'Item 2', name: 'rb-auto', inputValue: 2, checked: true},
       {boxLabel: 'Item 3', name: 'rb-auto', inputValue: 3},
       {boxLabel: 'Item 4', name: 'rb-auto', inputValue: 4},
       {boxLabel: 'Item 5', name: 'rb-auto', inputValue: 5}
   ]
 }
+3
source share
2 answers
+1

ExtJS 4, :

{ "data" : 
    [ 
      { "id" : "RadioGroupName",
        "value" : 
            { "RadioGroupName" : "inputValue" }
      },
      { "id" : "RadioGroupName2",
        "value" : 
            { "RadioGroupName2" : "inputValue" }
      }
    ],
  "success" : true
}
+2

Source: https://habr.com/ru/post/1726589/


All Articles