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

Cannot override CSS styles on dropdownlist

3 Answers 2820 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Amelia
Top achievements
Rank 1
Amelia asked on 21 Aug 2013, 08:21 PM
I am trying very hard to get styling to work for the DropDownList. I need to do some VERY specific styles that the Theme Builder does not let me edit.

I already did this fine with the "Menu" widget, but with the "DropDownList" widget, it just ignores styles unless I declare them to be page wide (I cannot put them underneath another tag)

For example, consider the following ...

<div class="grid skinName" style="background-color: #eadca6;">
    <div class="row">
        <h2>Drop Down List</h2>
        <select data-role="dropdownlist"
            data-text-field="Name" data-value-field="Id"
            data-bind="source: data, value: selected">
        </select>
    </div>
</div>
The select list is nested under the div with a class "skinName", so in my CSS, I do the following...

.skinName {
    .k-list-container {
        display: block !important;
    }
 
    .k-widget,
    .k-dropdown,
    .k-list-container,
    .k-dropdown-wrap,
    .k-group,
    .k-popup,
    .k-reset,
    .k-header {
        background-color: #f8f5e6;
        border-width: 0px;
        padding-top: 0px;
        color: #000;
 
        .k-input {
            font-family: 'Times New Roman', serif;
        }
 
        .link {
            a, a:link {
                font-size: 14px;
                color: #fff;
 
                &:hover {
                    background: #fff;
                    color: #000;
                }
            }
        }
    }
}


This should style it fine, but Kendo forcefully creates the extra HTML for the widget outside of the bounds of the original DOM element that I intended for it to be in, so these styles never get applied. Is there any way to force kendo to adhere to the toplevel class I specify?

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 22 Aug 2013, 07:09 AM
Hello Amelia,

Please refer to the following forum post, which explains how to apply custom styling to Kendo UI widget popups:

http://www.kendoui.com/forums/kendo-ui-web/general-discussions/setting-a-theme-on-individual-controls.aspx#3n0W5ltgZU2yIdigOduqCg


Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Amelia
Top achievements
Rank 1
answered on 24 Aug 2013, 12:57 AM
That works to a limited extent, but the class 'km-popup' still does not get wrapped by the right class, and is causing sizing issues. Is there any way to get direct access to it? I can't use a blanket style, it needs to be capable of doing it on a specific basis.
0
Dimo
Telerik team
answered on 26 Aug 2013, 08:10 AM
Hello Amelia,

The km-popup class is applied to the same element, which has the k-animation-container class. You can obtain reference to this element by using setTimeout in the DropDownList's open event and getting the list's parent(), as shown for the DatePickers.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
DropDownList
Asked by
Amelia
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Amelia
Top achievements
Rank 1
Share this question
or