GridColorPicker.js 928 Bytes
Ext.define('amdaUI.GridColorPicker', {
    extend: 'Ext.form.field.Picker',
    alias: 'widget.gridcolorpicker',
    toUpper : function(x){ 
        return x.toUpperCase();
    },
    replaceColor : function(x){
        return x.replace("#","");
    },
    createPicker: function() {
        var me = this;
        return Ext.create('Ext.picker.Color', {
            pickerField: me,
            renderTo: Ext.getBody(),
            floating: true,
            minWidth: 133,
            maxWidth: 200,
            minHeight: 225,
            autoScroll:true,
            focusOnShow: true,
            colors: amdaDefaultConfigs.availableColorsNew.map(this.replaceColor).map(this.toUpper),
            listeners: {
                select: function(picker, color) {
                    me.setValue('#'+color);
                    me.picker.hide();
                },
                scope: me
            }
        });
    }
});