Commit 58780dd251921c0b4ed6975f3e04e4815252dec3

Authored by Benjamin Renard
1 parent 5ea836ce

Fix bug with ColorPicker

js/app/views/DefaultTreeGrid.js
@@ -6,7 +6,7 @@ Ext.define('amdaUI.DefaultTreeGrid', { @@ -6,7 +6,7 @@ Ext.define('amdaUI.DefaultTreeGrid', {
6 'Ext.grid.*', 6 'Ext.grid.*',
7 'Ext.tree.*', 7 'Ext.tree.*',
8 'amdaModel.DefaultValuesModel', 8 'amdaModel.DefaultValuesModel',
9 - 'amdaUI.ColorPicker', 9 + 'amdaUI.GridColorPicker',
10 'amdaUI.ColorMap' 10 'amdaUI.ColorMap'
11 ], 11 ],
12 xtype: 'tree-grid', 12 xtype: 'tree-grid',
@@ -68,7 +68,7 @@ Ext.define('amdaUI.DefaultTreeGrid', { @@ -68,7 +68,7 @@ Ext.define('amdaUI.DefaultTreeGrid', {
68 } 68 }
69 var value = context.record.get(context.field); 69 var value = context.record.get(context.field);
70 if (me.isHexCode(value)) { 70 if (me.isHexCode(value)) {
71 - var colorPicker = Ext.create('amdaUI.ColorPicker', { 71 + var colorPicker = Ext.create('amdaUI.GridColorPicker', {
72 pickerField: context.field, 72 pickerField: context.field,
73 value: value, 73 value: value,
74 listeners: { 74 listeners: {
@@ -136,6 +136,8 @@ Ext.define('amdaUI.DefaultTreeGrid', { @@ -136,6 +136,8 @@ Ext.define('amdaUI.DefaultTreeGrid', {
136 136
137 if (option && option.type){ 137 if (option && option.type){
138 fieldType = option.type; 138 fieldType = option.type;
  139 + if (fieldType == 'colorpicker')
  140 + fieldType = 'gridcolorpicker';
139 var myStore = Ext.create('Ext.data.Store', { 141 var myStore = Ext.create('Ext.data.Store', {
140 fields: ['key', 'value'], 142 fields: ['key', 'value'],
141 data: option.store 143 data: option.store
@@ -145,7 +147,7 @@ Ext.define('amdaUI.DefaultTreeGrid', { @@ -145,7 +147,7 @@ Ext.define('amdaUI.DefaultTreeGrid', {
145 } 147 }
146 else{ 148 else{
147 if(me.isHexCode(value)){ 149 if(me.isHexCode(value)){
148 - fieldType = 'colorpicker' 150 + fieldType = 'gridcolorpicker'
149 } 151 }
150 else if(value === true || value === false){ 152 else if(value === true || value === false){
151 fieldType = 'combobox' 153 fieldType = 'combobox'
js/app/views/ColorPicker.js renamed to js/app/views/GridColorPicker.js
1 -Ext.define('amdaUI.ColorPicker', { 1 +Ext.define('amdaUI.GridColorPicker', {
2 extend: 'Ext.form.field.Picker', 2 extend: 'Ext.form.field.Picker',
3 - alias: 'widget.colorpicker', 3 + alias: 'widget.gridcolorpicker',
4 toUpper : function(x){ 4 toUpper : function(x){
5 return x.toUpperCase(); 5 return x.toUpperCase();
6 }, 6 },
js/app/views/StatusGrid.js
@@ -4,11 +4,11 @@ Ext.define('StatusColorEditor', { @@ -4,11 +4,11 @@ Ext.define('StatusColorEditor', {
4 alias: 'widget.statuscoloreditor', 4 alias: 'widget.statuscoloreditor',
5 5
6 requires: [ 6 requires: [
7 - 'amdaUI.ColorPicker' 7 + 'amdaUI.GridColorPicker'
8 ], 8 ],
9 9
10 field: { 10 field: {
11 - xtype: 'colorpicker' 11 + xtype: 'gridcolorpicker'
12 }, 12 },
13 }); 13 });
14 14
@@ -158,7 +158,6 @@ Ext.define('amdaUI.StatusGrid', { @@ -158,7 +158,6 @@ Ext.define('amdaUI.StatusGrid', {
158 return { 158 return {
159 text: 'Color',dataIndex: 'color', width: 40, menuDisabled: true, 159 text: 'Color',dataIndex: 'color', width: 40, menuDisabled: true,
160 renderer: function(value) { 160 renderer: function(value) {
161 - console.log(value);  
162 return '<div style="background-color:' + value + '; margin-left: auto; \ 161 return '<div style="background-color:' + value + '; margin-left: auto; \
163 margin-right: auto;width:15px;height:15px;"></div>'; 162 margin-right: auto;width:15px;height:15px;"></div>';
164 }, 163 },