<input name="color" type="color">

Questions<input name="color" type="color">
Lazaro Gustavo asked 5 years ago

Dear Abu. There is some possibility in phpGrid to show the color palette as shown in the screenshot that I send you. The color field is inside my table.

Attach : https://imgur.com/a/eVWAfyQ

3 Answers
Abu Ghufran Staff answered 5 years ago

Hi,

For this and all other INPUT attributes, you can set them in editoptions. E.g.

$col = array();
$col[“title”] = “Client”;
$col[“name”] = “name”;
$col[“width”] = “100”;
$col[“editable”] = true;
$col[“editoptions”][“type”] = “color”; 
$cols[] = $col;

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Gustavo Lazaro answered 5 years ago
Hello abu It helped me what you envy me, but the value does not save it in the table. What will be happening? Can you put a default color? Thank you

https://imgur.com/gallery/vxn0GIP
Abu Ghufran Staff answered 5 years ago

Hello,

I tested more on it and Instead of above, you can use following column setting:

$col = array();
$col[“title”] = “gender”;
$col[“name”] = “gender”;
$col[“editable”] = true;
$col[“width”] = 500;
$col[“editoptions”][“dataInit”] = “function(o){setTimeout(function(){

jQuery(o).parent().append(‘<input type=color />’);
jQuery(o).parent().find(‘input[type=color]’).change(function(){ o.value=this.value; });
jQuery(o).hide();

},200);}”;
$cols[] = $col;

The datainit event is called when textbox is shown. We appended a color input, connect the values on change event and hides the text input.

https://gist.github.com/gridphp/dc0399704cbfaa31f682896e4738eb64

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

13 + 9 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?