How To Add Link After Each Label In CheckboxGroup

By Vitaliy on April 26, 2012. ExtJS 3.4.0
2925
Reply to thread

Js Code

new Ext.form.CheckboxGroup({
	columns: 1,
	items: [
		{ boxLabel: 'Item 1', name: 'cb-1' },
		{ boxLabel: 'Item 2', name: 'cb-2', checked: true },
		{ boxLabel: 'Item 3', name: 'cb-3' }
	],
	listeners: {
		render: function () {
			var link
			this.items.each(function (item) {
				link = item.el.parent().insertHtml('beforeEnd',
					'<a href="javascript:void(0)" class="details-link">Details</a>', true);
				link.on('click', function () {
					Ext.Msg.alert('Details', String.format('Item {0} clicked!', item.name));
				});
			});
		}
	},
	renderTo: 'output'
});    

ExtJS 3: Add A CheckboxGroup Dynamically To A Form

By Vitaliy on April 21, 2012. ExtJS 3.4.0
3785
Reply to question

Js Code

new Ext.form.FormPanel({
	title: 'Test Form',
	labelWidth: 120,
	width: 350,
	padding: 10,
	tbar: [{
		text: 'Add CheckboxGroup',
		handler: function () {
			formPanel.add({
				xtype: 'checkboxgroup',
				fieldLabel: 'My CheckboxGroup',
				columns: 1,
				items: items
			});
			formPanel.doLayout();
			this.disable();
		}
	}],
	items: comboBox,
	renderTo: 'output'
});