Recurrence EventTemplate

6 posts, 0 answers
  1. Zoran
    Zoran avatar
    10 posts
    Member since:
    Sep 2012

    Posted 24 Nov 2015 Link to this post

    I have an event template:

    <script id="event-template" type="text/x-kendo-template">
        <div style='background-color: #=Color#'>
            <span>#= title #</span>
        </div>
    </script>

    I base the color on the start date of the event which works fine for all events except for those with recurrence events.

    Since the parent recurrence event was set up in the past it displays the color data from the parent and not the actual recurrence event which is in the future.

    How can I setup the recurrence event data when it is displayed on the scheduler?

     

  2. Zoran
    Zoran avatar
    10 posts
    Member since:
    Sep 2012

    Posted 24 Nov 2015 Link to this post

    Fixed it:

    <script id="event-template" type="text/x-kendo-template">
        #if(start >= new Date()){#
            <div style='background-color: blue'>

         #}else{#
                # if (ProcedureCode == null) {#
            <div style='background-color: gray'>
                #}else{#
                <div style='background-color: darkgreen'>
                    #}#
                    #}#
                    <span>#= title #</span>
                </div>
    </script>

     

    But if the event length is longer than the title, it shows the default background.

  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 26 Nov 2015 Link to this post

    Hello Zoran,

    The described issue seems be a styling problem that should be addressed with custom CSS. Could you send us a repro demo (Dojo or smth else), which we can review locally? Thus we will be able to fully understand the case and suggest the most suitable solution promptly.

    Regards,
    Georgi Krustev
    Telerik
    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
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 26 Nov 2015 Link to this post

    Hello Zoran,

    I would like to follow up my last message to provide additional details about the styling.

    If you would like to change the background of the event with CSS class name, then you can use the following approach: Another option is to render the custom CSS class in the event template and then manually move that class to the div.k-event element in the widget's dataBound event. Thus the styling will be applied to the whole event element.

    Regards,
    Georgi Krustev
    Telerik
    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
  6. Zoran
    Zoran avatar
    10 posts
    Member since:
    Sep 2012

    Posted 01 Dec 2015 in reply to Georgi Krustev Link to this post

    So I changed the event template to this:

     <script id="event-template" type="text/x-kendo-template">
        <div class="movie-template">
          <h3>#: title #</h3>
          </div>
        </script>

    And you can see that the red background now shows for your events as well.

  7. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 03 Dec 2015 Link to this post

    Hello Zoran,

    The approach is the same - you need to set margin:0 to the first element in the template:
    Regards,
    Georgi Krustev
    Telerik
    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready