ExtJS 4.1.0 ComboBox "setValue" Method

Posted By Vitaliy | June 26, 2012 | ExtJS 4.1.0
0 6784
In ExtJS 4.0.7 we can set combobox value by valueField, displayField or an object.
In ExtJS 4.1.0 - only by valueField or displayField.

Reply to thread

Js Code

Ext.widget('form', {
	title: 'Test Form',
	width: 400,
	bodyPadding: 10,
	tbar: [
		{
			text: 'Set value by id',
			handler: function () {
				this.up('form').down('#combo-1').setValue(1);
			}
		},
		{
			text: 'Set value by name',
			handler: function () {
				this.up('form').down('#combo-2').setValue('User-2');
			}
		},
		{
			text: 'Set value by object',
			handler: function () {
				this.up('form').down('#combo-3').setValue({ id: 3, name: 'User-3' });
			}
		}
	],
	items: [
		{
			itemId: 'combo-1',
			fieldLabel: 'By id',
			xtype: 'combouser'
		},
		{
			itemId: 'combo-2',
			fieldLabel: 'By name',
			xtype: 'combouser'
		},
		{
			itemId: 'combo-3',
			fieldLabel: 'By object',
			xtype: 'combouser'
		}
	],
	renderTo: Ext.getBody()
});
            

ExtJS 4.0.7 ComboBox "setValue" Method

Posted By Vitaliy | June 26, 2012 | ExtJS 4.0.7
0 3924
In ExtJS 4.0.7 we can set combobox value by valueField, displayField or an object.
In ExtJS 4.1.0 - only by valueField or displayField.

Reply to thread

Js Code

Ext.widget('form', {
	title: 'Test Form',
	width: 400,
	bodyPadding: 10,
	tbar: [
		{
			text: 'Set value by id',
			handler: function () {
				this.up('form').down('#combo-1').setValue(1);
			}
		},
		{
			text: 'Set value by name',
			handler: function () {
				this.up('form').down('#combo-2').setValue('User-2');
			}
		},
		{
			text: 'Set value by object',
			handler: function () {
				this.up('form').down('#combo-3').setValue({ id: 3, name: 'User-3' });
			}
		}
	],
	items: [
		{
			itemId: 'combo-1',
			fieldLabel: 'By id',
			xtype: 'combouser'
		},
		{
			itemId: 'combo-2',
			fieldLabel: 'By name',
			xtype: 'combouser'
		},
		{
			itemId: 'combo-3',
			fieldLabel: 'By object',
			xtype: 'combouser'
		}
	],
	renderTo: Ext.getBody()
});
            

ComboBox Tooltip With Double Quotes

Posted By Vitaliy | April 26, 2012 | ExtJS 3.4.0
0 3458
Reply to thread

Js Code

Ext.onReady(function () {
	Ext.QuickTips.init();

	var store = ['111', '222 "asdf"', '333'];

	for (var i = 0; i < store.length; i++) {
		store[i] = Ext.util.Format.htmlEncode(store[i]);
	}

	new Ext.form.FormPanel({
		title: 'Test form',
		width: 350,
		padding: 5,
		items: [{
			xtype: 'combo',
			tpl: '<tpl for="."><div ext:qtip="tip: {field1}" class="x-combo-list-item">text: {field1}</div></tpl>',
			fieldLabel: 'Test combo',
			anchor: '100%',
			store: store
		}],
		renderTo: Ext.getBody()
	});
});
            

ExtJS 3: Add A CheckboxGroup Dynamically To A Form

Posted By Vitaliy | April 21, 2012 | ExtJS 3.4.0
0 4703
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: Ext.getBody()
});