Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extjs with Radiogroup

can we bind static json store with radiogroup in ext?

like image 205
Mutant Avatar asked Feb 24 '23 14:02

Mutant


1 Answers

Radiogroups and Stores are not directly related in ExtJS. It's easy to populate form values from a store, but using a store to actually create the fields requires a slight work around. Specifically, you would have to do something like this (assuming Ext 3.3.1), and that your JsonStore is already set up...

var store = <your predefined store, with records>;
var itemsInGroup = [];

store.each( function(record) {
  itemsInGroup.push( {
      boxLabel: record.someLabel, 
      name: record.someName, 
      inputValue: record.someValue
    });  
});

var myGroup = { 
  xtype: 'radiogroup', 
  fieldLabel: 'My Dynamic Radiogroup', 
  items: itemsInGroup 
};
like image 191
Christopher WJ Rueber Avatar answered Mar 06 '23 09:03

Christopher WJ Rueber