ExtJS 6 Button with SVG Icon

Posted By Vitaliy | May 10, 2017 | ExtJS 6.0.1
0 349
This post is a reply to this question.

There are two config options to set button's image:
  • iconCls - one or more space separated CSS classes to be applied to the icon element
  • icon - Url to the icon

Js Code

items: [{
    text: 'Icon from CSS',
    iconCls: 'my-icon'
}, {
    text: 'Icon from Url',
    icon: 'https://image.flaticon.com/icons/svg/417/417782.svg'
}]
            

ExtJS 4: HtmlEditor Clear All Tags Button

Posted By Vitaliy | February 02, 2014 | ExtJS 4.2.2
0 3906
We can make this button as a simple plugin for HtmlEditor.

Js Code

Ext.define('Ext.form.plugin.ClearTags', {
    regex: /(<([^>]+)>)/ig,
    regexSpaces: /(\s|&nbsp;)+/g,
    ...
    onRender: function () {
        ...
        tb.add({
            ...
            handler: function () {
                var value = ed.getValue() || '',
                    result = value.replace(me.regex, ' ').replace(me.regexSpaces, ' ');
                ed.setValue(result);
            }
        });
    }
});
            

ExtJS 3: HtmlEditor Clear All Tags Button

Posted By Vitaliy | February 02, 2014 | ExtJS 3.4.0
0 3589
We can make this button as a simple plugin for HtmlEditor.

Js Code

Ext.form.plugin.ClearTags = Ext.extend(Ext.util.Observable, {
    regex: /(<([^>]+)>)/ig,
    regexSpaces: /(\s|&nbsp;)+/g,
    ...
    onRender: function () {
        ...
        tb.addButton({
            ...
            handler: function () {
                var value = ed.getValue() || '',
                    result = value.replace(me.regex, ' ').replace(me.regexSpaces, ' ');
                ed.setValue(result);
            }
        });
    }
});
            

How To Reload Window Content

Posted By Vitaliy | April 03, 2012 | ExtJS 4.0.7
1 3919
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');
		}
	}]
});