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. Image for the cookie policy date

How to add reset color option in syncfusion colorpicker

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

5 Replies

VK Vinoth Kumar Sundara Moorthy Syncfusion Team 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 



EB Ebenezer 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


VK Vinoth Kumar Sundara Moorthy Syncfusion Team 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 



EB Ebenezer 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


VK Vinoth Kumar Sundara Moorthy Syncfusion Team 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 


Loader.
Live Chat Icon For mobile
Up arrow icon