Commit 2ecafeae36cbcca9eab46237b64b4f7c3854ba1d

Authored by Julien Verneuil
1 parent 1ea67eb5

fix jscolor input in jqgrid

Showing 2 changed files with 6 additions and 6 deletions   Show diff stats
view/jqgrid.anubis
... ... @@ -64,7 +64,7 @@ define String
64 64 var el = document.createElement('input');
65 65 el.type='text';
66 66 el.value = value;
67   - var myPicker = new jscolor.color(el, {});
  67 + var myPicker = new jscolor(el);
68 68 myPicker.fromString(value);
69 69 return el;
70 70 },
... ... @@ -130,7 +130,7 @@ define String
130 130 date(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, formatter: \"date\", formatoptions: { newformat: \"Y-M-d\" }}",
131 131 time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true }",
132 132 datetime(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true }",
133   - color(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", width: 40, editable:true, autoResizable: true, formatter:formatColor, unformat:unformatColor, "+custom_edit_color+" }",
  133 + color(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", width: 40, editable:true, autoResizable: true, edittype: 'custom', formatter:formatColor, unformat:unformatColor, "+custom_edit_color+" }",
134 134 phone(label,column_name, ph_type, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype: 'custom', formatter:formatPhone, unformat:unformatPhone, "+custom_edit_phone+"}",
135 135 email(label,column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype: 'custom', formatter:formatEmail, unformat:unformatEmail, "+custom_edit_email+"}",
136 136 url(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, "+search_options(column_name)+" }",
... ...
view/view_table_renderer.anubis
... ... @@ -437,15 +437,15 @@ url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&vi
437 437 // rows.json_data_string+
438 438 jqGrid_options(uid, rows, _T)+
439 439 ",loadComplete: function () {
440   - jscolor.installByClassName(\"jscolor\");
  440 +
441 441 }
442 442 }).jqGrid(\"gridResize\");
443 443 function formatColor(cellValue, options, rowObject) {
444   - var colorInput = \"<input class=\\\"jscolor\\\" value=\\\"\"+ cellValue + \"\\\">\";
445   - return colorInput;
  444 + var color_container = \"<div class=\\\"hk_jscolor\\\" data-color=\\\"\"+ cellValue + \"\\\" style=\\\"background-color:#\"+ cellValue + \"\\\"></div>\";
  445 + return color_container;
446 446 }
447 447 function unformatColor(cellValue, options, cellObject) {
448   - return $(cellObject.html()).css(\"backgroundColor\").substring(1);
  448 + return $(cellObject).find('.jscolor').data('color');
449 449 }
450 450 function formatPhone(cellValue, options, rowObject) {
451 451 var phoneInput = '<span class=\"hk_phone_call\"><img data-phone-number=\"'+cellValue+'\" src=\\\"/icons/16x16/phone.png\\\" onclick=\"hk_phone_call(this);\">' + cellValue + '</span>';
... ...