Blame view

js/app/views/GridColorPicker.js 928 Bytes
58780dd2   Benjamin Renard   Fix bug with Colo...
1
Ext.define('amdaUI.GridColorPicker', {
4f728fd9   Erdogan Furkan   For now 2
2
    extend: 'Ext.form.field.Picker',
58780dd2   Benjamin Renard   Fix bug with Colo...
3
    alias: 'widget.gridcolorpicker',
4f728fd9   Erdogan Furkan   For now 2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    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
            }
        });
    }
});