hide an All day event with template

4 posts, 2 answers
  1. Carlos
    Carlos avatar
    11 posts
    Member since:
    Apr 2015

    Posted 11 Oct Link to this post

    Hello!!!

    I'm using MVC Scheduler with a all day event template. 

    <script id="event-template" type="text/x-kendo-template">
        #if(data.IsControl && hasControlElement(data)) {#
                #= title#
         #}else {#
        <div class="amagat">
        </div>
        #}#
    </script>

    I want to hide all the events with the template that contains <div class="amagat"/>

    I've tried it by javascript and css, but no luck... 

    <style>
        .k-event > .amagat {visibility: hidden ; display: none}
    </style>

     

    I've attached two images with the current result and the desired result.

     

    Thanks!!

  2. Answer
    Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    283 posts

    Posted 13 Oct Link to this post

    Hi Carlos,

    As CSS does not offer to select a parent (in your case the k-event <div>), based on a condition in its children (in your case the class amagat), you won't be able to achieve the desired using pure CSS. Instead, you will have to manually change the styles of those parent elements using jQuery:
    $('.k-event>.amagat').parent().css('visibility', 'hidden').css('display', 'none');

    Regards,
    Veselin Tsvetanov
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Carlos
    Carlos avatar
    11 posts
    Member since:
    Apr 2015

    Posted 19 Oct in reply to Veselin Tsvetanov Link to this post

    Hello!!! Thanks for you answer!

    But I don't have the expected result... it does nothing

    where do I put it???

    in the  $(document).ready(function () {})) ???

  5. Answer
    Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    283 posts

    Posted 20 Oct Link to this post

    Hello Carlos,

    You should call that function on the initial load of the widget, after the Scheduler content has already been rendered. You could do that in the $(document).ready(function(){....});. However, I would recommend you to use instead the dataBound() event of the Scheduler, which will be fired on each navigation / update / insert / remove executed on the Scheduler.

    Regards,
    Veselin Tsvetanov
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Back to Top
UI for ASP.NET MVC is VS 2017 Ready