This is a migrated thread and some comments may be shown as answers.

How to set kendo color picker value inside in a kendo template

3 Answers 634 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
zhivko.zhelezov
Top achievements
Rank 1
zhivko.zhelezov asked on 20 Nov 2015, 03:55 PM

Hi folks,

 I am having the following column template :

<script id="gridTemplate" type="text/x-kendo-template">
    <tr data-uid="#= uid #">
        <td>
            <input type="color" kendo-color-picker="colorPicker" k-palette="trend.colors" value="#= color #" on-change="trend.changeColor(colorPicker.value(), this)" />
            <button type="button" style="background-color:black; float:right;" class="btn btn-default btn-xs white" ng-click="trend.deleteSeries('#= tag#');"><span class="glyphicon glyphicon-remove"></span></button>
        </td>
        <td>
            #= tag#
        </td>
        <td>
            #= description#
        </td>
        <td>
            #= unit#
        </td>
    </tr>
</script>

The problem is with setting the color of the color picker (via the value attribute) in the first column.Initially in the dataItem, the value of color was in the form of #rrggbb, but this was resulting in an error (because of the "#" symbol). I changed it in rgba() and it was working fine with 2014 kendo release. Today I update to 2015 and now it does not work. Any suggestion how to fix it?

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 25 Nov 2015, 08:30 AM
Hello,

Could you clarify how is the provided template used? If you are using angular then could you check if setting the value as option:
<input kendo-color-picker="colorPicker" k-value="'#=color#'" />
or binding it to the item:
<input kendo-color-picker="colorPicker" ng-model="dataItem.color" />
helps.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Dinesh
Top achievements
Rank 1
answered on 07 Jul 2017, 11:11 AM

Hi.
i Created one simple Project where i am using kendo-UI Text-Editor  and i fixed my selector Color white to black in my CSS file.
but when i am selecting any other color its not displaying that selected color.
please help me.

this is my Css code.

span.k-selected-color {
     background-color: black !important;
}

in this 2nd Image i selected color Red but in selected-color it is showing black.

0
Ianko
Telerik team
answered on 11 Jul 2017, 07:47 AM

Hello Dinesh,

The questions asked is not related to the topic originally discussed in this thread. It is recommended to keep the forum threads on topic so that they can be helpful to others. Therefore, it is recommended to open new threads when it comes to new questions. 

However, the described behavior is expected. By overriding the background-color of the DOM element representing the selected color any other selected color is not respected. At least not in the color picker. Thus, I am not quite sure what would be the need to change the decoration of the color selection from white to black, when this value should be dynamically chosen by the user and not some predefined CSS rule.  

If, however, there is more behind this, I suggest you to open a new thread with more relevant information on the case.

Regards,
Ianko
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ColorPicker
Asked by
zhivko.zhelezov
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Dinesh
Top achievements
Rank 1
Ianko
Telerik team
Share this question
or