EasyUI Forum
April 24, 2024, 01:56:37 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: colorpicker in propertygrid  (Read 6106 times)
JeroenNL
Newbie
*
Posts: 37


View Profile
« on: February 26, 2017, 03:30:52 AM »

Hello,

I'm would like to have a colorpicker available as a row in a propertygrid. Is there a way to achieve this?

Cheers,
Jeroen
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 27, 2017, 02:05:22 AM »

Please download the simple color plugin from https://www.jeasyui.com/extension/downloads/jquery-easyui-color.zip
Logged
JeroenNL
Newbie
*
Posts: 37


View Profile
« Reply #2 on: March 05, 2017, 08:21:18 AM »

Hey that's very nice! Smiley

But... how do I use this color box in a propertygrid? The example uses a class, while the propertygrid expects an editor property?
Logged
JeroenNL
Newbie
*
Posts: 37


View Profile
« Reply #3 on: March 10, 2017, 02:41:12 AM »

Any clues?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 on: March 10, 2017, 07:56:17 AM »

Please extend the 'color' editor as below:
Code:
$.extend($.fn.datagrid.defaults.editors, {
    color: {
      init: function(container, options){
        var input = $('<input type="text" class="datagrid-editable-input">').appendTo(container);
        input.color(options);
        return input;
      },
      destroy: function(target){
        $(target).color('destroy');
      },
      getValue: function(target){
        return $(target).color('getValue');
      },
      setValue: function(target, value){
        $(target).color('setValue', value);
      },
      resize: function(target, width){
        $(target).color('resize', width);
      }
    }
})

And then apply the 'color' editor to the property row.
Code:
{"name":"Color","value":"#93c47d","group":"ID Settings","editor":"color"}
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!