How do you clear the slot template

7 posts, 0 answers
  1. Michael
    Michael avatar
    5 posts
    Member since:
    Jun 2014

    Posted 04 May 2015 Link to this post

    Hi,

    I'm using the slot template to show recommended events for each resource groups. My problem I am having is when I switch from one group to another the slot template just adds on to the slot template instead of replacing the existing one. Is there a way to reset the slot template each time you change the group view?

    I attached images below to show the what happens when I go from Rooms to Providers, and then how Providers should look.

    Thanks,

  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2196 posts

    Posted 06 May 2015 Link to this post

    Hello MIchael,

    Could you please provide the runable example where the issue is reproduced as from the provided information it's not clear for us what is the exact scenario that you have? This would help us advice you better how to proceed.

    Regards,
    Vladimir Iliev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Michael
    Michael avatar
    5 posts
    Member since:
    Jun 2014

    Posted 06 May 2015 Link to this post

    Hi Vlad,

    Here's an example to reproduce the issue.

    http://dojo.telerik.com/@michael.taylor/abOvE/15

    Thanks,

  4. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2196 posts

    Posted 07 May 2015 Link to this post

    Hello MIchael,

    Thank you for the provided example - after inspecting the demo it appears that the reason for current behavior is that for "providers" group more than one "div" element is rendered for each slot. Due to the current styles applied to the "div" elements they are overflowing the slot which causes current look. 

    '#  if((date >= start && date < end) && ( "' + $scope.resourceSelected + '" == "Providers" && type.providerId == resources.providerId)) { # ' +
      '       <div class="" style="background: #=type.color#; float: left; width: 6px; height: 138%; margin: -0.334em -.5em; opacity: 0.5">' +
     
      '#  if((date >= start && date < end) && ( "' + $scope.resourceSelected + '" == "Rooms" && type.roomId == resources.roomId)) { # ' +
      '       <div class="" style="background: #=type.color#; float: left; width: 6px; height: 138%; margin: -0.334em 0em; opacity: 0.5">' +
      '       </div>' +
      '#  } # ' +
      '#  if((date >= start && date < end) && type.providerId == null && type.roomId == null) { # ' +
      '       <div class="" style="background: #=type.color#;float: left; width: 6px; height: 138%; margin: -0.334em .5em; opacity: 0.5">' +
      '       </div>' +
      '#  } # ' +
      '#}); #';

    Regards,
    Vladimir Iliev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Michael
    Michael avatar
    5 posts
    Member since:
    Jun 2014

    Posted 07 May 2015 Link to this post

    You're correct, this would fix the overlapping. My issue is that it does not to remove the "div"s created from a group when I switch to a new group. Each slot is only to be expected to have one "div" element. Is there a way to achieve that?

  6. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2196 posts

    Posted 08 May 2015 Link to this post

    Hi MIchael,

    You can achieve the desired behavior by improving current template - more than one div elements are rendered due to the current logic which is used in the template (when groups are changed previous div elements are cleared correctly). 

    Regards,
    Vladimir Iliev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  7. Michael
    Michael avatar
    5 posts
    Member since:
    Jun 2014

    Posted 08 May 2015 Link to this post

    Hi Vlad,

    I'm glad it was just my logic. I didn't understand slot template to the full extent. Now that I know it only gets touched on initialization of the scheduler I can form my logic around that.

    I posted my example that resolved my issue to help anyone that needs an understanding some of the logic the slot template needs to separate the resources. It's not the best, but hope it helps!

    http://dojo.telerik.com/@michael.taylor/abOvE/21

    Thanks,

Back to Top