We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add reset color option in syncfusion colorpicker

Thread ID:

Created:

Updated:

Platform:

Replies:

143868 Apr 8,2019 03:17 PM UTC Apr 16,2019 12:41 PM UTC Angular - EJ 2 5
loading
Tags: ColorPicker
Ebenezer
Asked On April 8, 2019 03:17 PM UTC

Hi,
I am trying to create a reset button as well as functionality for color picker which is inside a treegrid.
Is there any way to render reset button in syncfusion colorpicker.
I have attached the snapshot with this mail.

This is my code:

<div class="col" id="color-picker-wrapper">
<i class="pointer" data-toggle="tooltip" title="color">
     <input ejs-colorpicker #colorpicker type='color' id="color-picker"
     (change)="onColorChanges($event, data)" />
</i>
</div>

Attachment: Issue_8c027107.zip

Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On April 9, 2019 04:51 PM UTC

Hi Ebenezer, 

Thank you for contacting Syncfusion support. 

We have checked your reported query “To add the reset button in ColorPicker component” and we have prepared the workaround solution to achieve your requirement by adding the reset button in the open event in the ColorPicker component. Please refer to the below code example. 

HTML 
<h4>Choose a color</h4> 
<button #flatbtn ejs-button id="flatbtn" cssClass="e-small e-flat e-resetbtn" (click)="btnClick() ">Reset</button> 
<input #colorpicker ejs-colorpicker id='color-picker' type='color' (open)="Open($event)" /> 

TS 
export class AppComponent { 
   
    @ViewChild('flatbtn') 
    public flatbtn: ButtonComponent; 
   
    @ViewChild("colorpicker") 
    public colorpicker: ColorPickerComponent; 
   
    public Open(args: OpenEventArgs): void { 
        var applyBtn = (args.element.parentElement).querySelector('.e-ctrl-btn') as HTMLElement; 
        applyBtn.appendChild(this.flatbtn.element); 
        this.flatbtn.element.style.display = "inline"; 
    } 
 
    btnClick() { 
        this.colorpicker.value = "#008000"; 
        /** Closing color picker popup by manual click */ 
        (this.flatbtn.element.previousSibling as HTMLElement).click(); 
    } 
} 




Could you please check the above sample and get back to us if we misunderstood your requirement or you need further assistance on this? 

Regards, 
Vinoth Kumar S 


Ebenezer
Replied On April 11, 2019 09:25 AM UTC

Hi,
I need to change the default color of colorpicker.(say: it take green as default color as of now) If any solution available, please do the needful ASAP.


Regards,
Justin Ebenezer

Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On April 11, 2019 12:28 PM UTC

Hi Ebenezer, 
 
Thank you for your update. 
 
We have checked your requirement “To change the default color of colorpicker” and it is achievable by using value property of ColorPicker. Please check the below code snippet. 
 
HTML 
<input #colorpicker ejs-colorpicker id='color-picker' [value]="colorValue" type='color' (open)="Open($event)" /> 
 
TS 
export class AppComponent { 
    public colorValue: string = '#0db1e7'; 
    //.. 
} 
 
For your convenience we have modified the previously provided stackblitz sample and same can be found in below link, 
 
 
Could you please check the above sample and get back to us with more information if you need any further assistance on this? 
 
Regards, 
Vinoth Kumar S 


Ebenezer
Replied On April 12, 2019 02:35 PM UTC

Hi, 
Thanks for your reply.

As of now color picker reset was not working with multiple color picker controls. But, in my case color picker control was inside array list view, example provided by your side was only working with single control. Kindly check and do, provide respective example.

Note : I have attached sample code below.

Regards, 
Justin Ebenezer

Attachment: Bug2InLocalHost_(2)_f48f42.zip

Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On April 16, 2019 12:41 PM UTC

Hi Ebenezer, 
 
Good day to you. 
 
We have prepared a sample based on your requirement “To perform reset operation in multiple ColorPicker inside Treegrid” and same can be found in below link, 
 
 
Could you please check the above sample and get back to us if you need any further assistance on this? 
 
Regards, 
Vinoth Kumar S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon