Extjs with a radio band

can we associate json static storage with radio group in ext?

+4
source share
2 answers

Radio groups and stores are not directly connected to ExtJS. It's easy to fill out form values ​​from a store, but using a store to create fields requires a little work. In particular, you will need to do something similar (assuming Ext 3.3.1) and that your JsonStore is already configured ...

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 }; 
+8
source

You can use dataView for this operation. Depending on the storage value, you can add switches. Suppose your store has 5 items besides 5 switches.

  var tpl = new Ext.XTemplate('<tpl for=".">', '<div class="thumb-wrap" style="width:210px; float: left;">', '<label >', '<tpl>', '<input type=radioField value={fieldId} >', '</tpl>', '{dataViewFieldName}', '</label>', '</div>', '</tpl>', { }); var me = this; this.items = new Ext.DataView({ store: this.store, tpl: tpl, overClass: 'x-view-over', itemSelector: 'div.thumb-wrap', autoScroll: true }); this.callParent(); }, 
0
source

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


All Articles