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

How do you clear the slot template

6 Answers 191 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 04 May 2015, 02:53 PM

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,

6 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 06 May 2015, 08:25 AM
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!
 
0
Michael
Top achievements
Rank 1
answered on 06 May 2015, 02:29 PM

Hi Vlad,

Here's an example to reproduce the issue.

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

Thanks,

0
Vladimir Iliev
Telerik team
answered on 07 May 2015, 07:30 AM
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!
 
0
Michael
Top achievements
Rank 1
answered on 07 May 2015, 01:34 PM

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?

0
Vladimir Iliev
Telerik team
answered on 08 May 2015, 06:09 AM
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!
 
0
Michael
Top achievements
Rank 1
answered on 08 May 2015, 01:52 PM

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,

Tags
Scheduler
Asked by
Michael
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Michael
Top achievements
Rank 1
Share this question
or