How to stop Telerik CSS from overriding local changes?

bowlturner

I have a Kendo Grid and it the default CSS background-color or 'text' Color are what always display.

I was able to override the background colors with lines 1 & 2, however, it just replaced the colors. What I need to to be able to set the color based on the "InTruck" Boolean field.

I tried lines 5 and 6, and the html mark up is correctly updated and sometimes I see it flash the correct color before it is reset to the defaults. I have also tried adding in !important in rows 3 and 5, still no luck. Something seems to be setting the style AFTER everything is done using the kendo/telerik css. How do I stop that?

<style>
1    /*.k-grid-content>table>tbody>tr{background-color:lightgreen;}*/
2    /*.k-grid-content>table>tbody>.k-alt{background-color:red;}*/
3    .IN{color:lightgreen;}
</style>

<div id="divSearchResults">
@(Html.Kendo().Grid((IEnumerable<Models.SearchResult>)Model.SearchResults)
4   //        .Events(ev => ev.DataBound("Grid_onRowDataBound"))
5   //        .RowAction(row => { if (row.DataItem.InTruck) row.HtmlAttributes["style"] = "background-color:lightgreen"; else  row.HtmlAttributes["style"] = "background-color:red !important"; })
    .Name("grid")
6           .RowAction(row =>
        {
            if (row.DataItem.InTruck)
            {
                row.HtmlAttributes["class"] = "IN";
            }
        })
    .DataSource(ds => ds.Ajax()
        .PageSize(Constants.MaxSearchReults)
        .Model(mod =>
            {
                mod.Id(m => m.ID);
                mod.Field(p => p.Name).Editable(false);
                mod.Field(p => p.CarrierCode).Editable(false);
                mod.Field(p => p.CityState).Editable(false);
                mod.Field(p => p.Phone).Editable(false);
            }))

    .Columns(columns =>
    {
        columns.Template(@<text></text>).ClientTemplate("<input type='checkbox' #= IsSelected ? checked='checked':'' # class='chkbx' value='#= CarrierID#' name='SelectedArea' />")
                .HeaderTemplate("<input type='checkbox' id='masterCheckBox' onclick='checkAll(this)'/>").Width(20);
        columns.Bound(p => p.Name).Filterable(false).Width(100);
        columns.Bound(p => p.CarrierCode).Filterable(false).Width(75);
        columns.Bound(p => p.CityState).Filterable(false).Width(100);
        columns.Bound(p => p.Phone).Filterable(false).Width(75);
    })
                .Editable(ed => ed.Mode(GridEditMode.InCell))
                .Pageable()
                .Sortable()
                .Scrollable()
                .Filterable()
)
</div> 
bowlturner

I never did figure out how to do exactly what I wanted, however, this solution has the same results and I think it looks better and easier on the eyes than what was asked for. It will set the color behind the checkbox so there is an obvious color difference but it isn't gaudy.

 .Columns(columns =>
 {
    columns.Template(@<text></text>)
           .ClientTemplate("<span style='float:left; width:100%; background:#= InTruckMate ? \"lightgreen\" : \"palevioletred\"#'><input type='checkbox' #= IsSelected ? checked='checked':'' # class='chkbx' value='#= CarrierID#' name='SelectedArea' /></span>")
           .HeaderTemplate("<input type='checkbox' id='masterCheckBox' onclick='checkAll(this)'/>")
           .Width(25);
    columns.Bound(p => p.Name).Filterable(false).Width(100);

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How to stop user from login?

분류에서Dev

How to stop browser auto scrolling containers on focus changes

분류에서Dev

How do I stop the following "External changes" message in Brackets

분류에서Dev

How do I stop the flickering in this css animation?

분류에서Dev

How to sync local git repo with origin/master eliminating all changes

분류에서Dev

How to remove/revert commited changes to local git repo

분류에서Dev

CSS overriding element with display property

분류에서Dev

How to stop a remote desktop session from ending

분류에서Dev

How to stop table from adjusting width

분류에서Dev

Git: how to choose code changes from a remote

분류에서Dev

CSS changes when navigating from and back to Page - React

분류에서Dev

How to execute jquery when a variable with a CSS property changes

분류에서Dev

CSS li a : visited overriding hover state on mobile

분류에서Dev

git restore local uncommited changes

분류에서Dev

How to run expressJS CLI from local installation

분류에서Dev

How can I stop gvim from crashing when opening a file?

분류에서Dev

How to stop USB full ubuntu install from probing hard disks?

분류에서Dev

How can I stop terminal and firefox from launching on startup?

분류에서Dev

How can I stop windows from always booting first?

분류에서Dev

How do I stop gedit from opening anything?

분류에서Dev

How to pause, resume and stop pyttsx3 from speaking?

분류에서Dev

How can I stop pages from scrolling with an empty hyperlink jump?

분류에서Dev

How to stop MAC address from changing after disconnecting?

분류에서Dev

How do I stop Thunderbird from forgetting my passwords?

분류에서Dev

How can I stop excel from rounding to .00?

분류에서Dev

How to stop Ubuntu from changing numlock state on boot?

분류에서Dev

How to call computation.stop() from within Deps.autorun()?

분류에서Dev

How to stop Blogger from adding indentation style in image links?

분류에서Dev

How to stop TextArea from "snapping" to a different size while using GridBagLayout

Related 관련 기사

  1. 1

    How to stop user from login?

  2. 2

    How to stop browser auto scrolling containers on focus changes

  3. 3

    How do I stop the following "External changes" message in Brackets

  4. 4

    How do I stop the flickering in this css animation?

  5. 5

    How to sync local git repo with origin/master eliminating all changes

  6. 6

    How to remove/revert commited changes to local git repo

  7. 7

    CSS overriding element with display property

  8. 8

    How to stop a remote desktop session from ending

  9. 9

    How to stop table from adjusting width

  10. 10

    Git: how to choose code changes from a remote

  11. 11

    CSS changes when navigating from and back to Page - React

  12. 12

    How to execute jquery when a variable with a CSS property changes

  13. 13

    CSS li a : visited overriding hover state on mobile

  14. 14

    git restore local uncommited changes

  15. 15

    How to run expressJS CLI from local installation

  16. 16

    How can I stop gvim from crashing when opening a file?

  17. 17

    How to stop USB full ubuntu install from probing hard disks?

  18. 18

    How can I stop terminal and firefox from launching on startup?

  19. 19

    How can I stop windows from always booting first?

  20. 20

    How do I stop gedit from opening anything?

  21. 21

    How to pause, resume and stop pyttsx3 from speaking?

  22. 22

    How can I stop pages from scrolling with an empty hyperlink jump?

  23. 23

    How to stop MAC address from changing after disconnecting?

  24. 24

    How do I stop Thunderbird from forgetting my passwords?

  25. 25

    How can I stop excel from rounding to .00?

  26. 26

    How to stop Ubuntu from changing numlock state on boot?

  27. 27

    How to call computation.stop() from within Deps.autorun()?

  28. 28

    How to stop Blogger from adding indentation style in image links?

  29. 29

    How to stop TextArea from "snapping" to a different size while using GridBagLayout

뜨겁다태그

보관