Создание плагина в ExtJS 6 - PullRequest
0 голосов
/ 25 мая 2018

В ExtJS 3 версии я создал plugin для отображения цветов в combobox, но я не могу использовать это plugin в ExtJS 6.

Это даетошибка:

combo.onRender.createSequence, а не функция

Вот код, и он работает в ExtJS 3:

Ext.namespace('Ext.ux.plugins');

Ext.ux.plugins.ColorCombo = function (config) {
    Ext.apply(this, config);
};

Ext.extend(Ext.ux.plugins.ColorCombo, Ext.util.Observable, {
    init: function (combo) {
            Ext.apply(combo, {
                tpl: '<tpl for="."><div class="search-item">' + 'Color Name: {' + combo.titleField + '}, Hex Value: {' + combo.displayField + '} <div style="float:right;width:50px;height=10px;background-color:{' + combo.displayField + '};">&nbsp;</div>' + '</div></tpl>',

                onRender: combo.onRender.createSequence(function (ct, position) {
                    // adjust styles
                    this.wrap.applyStyles({
                        position: 'relative'
                    });
                    this.el.addClass('ux-color-combo-input');

                    // add div for color
                    this.color = Ext.DomHelper.append(this.el.up('div.x-form-field-wrap'), {
                        tag: 'div',
                        style: 'position:absolute',
                        id: 'ColorHexBlock'
                    });
                }), // end of function onRender

                setColorCls: function () {
                    var rec = this.store.query(this.valueField, this.getValue()).itemAt(0);
                    if (rec) {
                        this.color.className = 'ux-color-combo-color ';
                        this.color.innerHTML = '<div style="float:right;width:50px;height=10px;background-color:' + rec.get(this.displayField) + ';">&nbsp;</div>';
                    }
                }, // end of function setColorCls

                setValue: combo.setValue.createSequence(function (value) {
                    this.setColorCls();
                });
            });
        } // end of function init
}); // end of extend

Как мне это сделать в ExtJS 6 classic?

...