How To Reload Window Content

By Vitaliy on April 03, 2012. ExtJS 4.0.7
3358
Reply to thread

Js Code

Ext.widget('window', {
	title: 'Test window',
	autoShow: true,
	width: 300,
	height: 150,
	bodyStyle: { 'background-color': '#FFFFFF', 'padding': '10px' },
	autoLoad: { url: '/postdata/getcontent/1' },
	tbar: [{
		text: 'Reload',
		handler: function () {
			var win = this.up('window');
			win.loader.load(win.autoLoad.url);
		}
	}, {
		text: 'Reset',
		handler: function () {
			var win = this.up('window');
			win.update('<b>Init</b> content');
		}
	}]
});    

Window FAQ: Confirm Window Closing

By Vitaliy on March 31, 2012. ExtJS 4.0.7
2508
This example shows how to close window only after user confirmation.

Js Code

Ext.widget('window', {
	title: 'Test Window',
	html: 'Close Me',
	width: 400,
	height: 200,
	bodyPadding: 10,
	autoShow: true,
	onEsc: Ext.emptyFn,
	listeners: {
		beforeclose: function () {
			if (this.confirmed === true) {
				this.confirmed = false;
				return true;
			}
			Ext.Msg.confirm('Test Window Closing...', 'Are you sure?', function (button) {
				if (button == 'yes') {
					this.confirmed = true;
					this.close();
				}
			}, this);
			return false;
		}
	}
});    

Window FAQ: Window With Question Icon

By Vitaliy on March 27, 2012. ExtJS 4.0.7
1875
Simple question message.

Js Code

Ext.Msg.show({
	title: 'Question',
	msg: 'Some question here!',
	width: 300,
	buttons: Ext.Msg.YESNOCANCEL,
	icon: Ext.Msg.QUESTION,
	fn: function (button) {
		Ext.Msg.alert('Callback', Ext.String.format('"{0}" button was clicked!', button));
	}
});