search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

ScrollPositionHour not working with DayPilotCalendar in AjaxControlToolkit.TabContainer

Asked by Fabrizio Cioni
16 years ago.
Version 4.6.1385.0
HeightSpec=BusinessHoues

Two samples
1) I have multiple tabs, calendar in one tab, grids in the others. ScrollPositionHour never activate, not in startup, not when passing between tabs
2) i have multiple tabs, calendar in more than one tab, ScrollPositionHour does not activate on startup but when passing from one tab to the other activates after a few seconds delay

I was using DayPilotLite version 2.3.206.0 and had no problem at all, i just passed to pro, distributed the update and... Doh!

Thanks in advance for your help,
Fabrizio
Comment posted by Fabrizio Cioni
16 years ago.
Oh, just to detail i've also tried the workaround i found on bug forums
dpc.$('scroll').scrollTop = valueInPixels;

setting dpc to calObject.ClientId but just got javascript error
Answer posted by Dan Letecky
16 years ago.
The problem is caused by DayPilotCalendar being placed inside a hidden div (style="display:none"). It's not possible to set .style.scrollTop for elements that are inside such a hidden div.

Solution:

1. DayPilotCalendar is in the first tab
Just set ActiveTabIndex property of <ajaxToolkit:TabContainer> tag to "-1".

2. DayPilotCalendar is in another tab or there are more instances of DayPilotCalendar (in more than one tab)
You need to call the scrollbar position update function from the OnClientActiveTabChanged event:

<script type="text/javascript">
function updateScrollPos() {
dpc1.enableScrolling();
// dpc1 is the value of ClientObjectName property of DayPilotCalendar
// remember to call it for all DayPilotCalendar instances
}
</script>

<ajaxToolkit:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="-1" OnClientActiveTabChanged="updateScrollPos" >
...
Comment posted by Fabrizio Cioni
16 years ago.
Thanks a lot, both your tips worked wonderfully.
Meanwhile sadly i found a minor bug (or at least it seems so to me).
If the value of the DataTextField contains the ' character (like in O'Connell) the event box gets all blacked out.

This is a minor problem still... in italian language is a commonly used character.
Thanks in advance for any help you can bring, you already saved my day.

Cheers,
Fabrizio
Comment posted by Geir-Tore Lindsve
15 years ago.
Any idea how to fix this within a ModalPopupExtender?
Comment posted by Dan Letecky
15 years ago.
What you need to do is to invoke dpc1.enableScrolling(); after the modal Panel is made visible.

  1. I'm not sure whether it's possible to hook the show event of the ModalPopupExtender on the client side (that would be the right place to put it).
  2. You could also try to invoke it manually and add the enableScrolling() call right after the show() call:
$find('mdlPopupExtender').show();
dpc1.enableScrolling();
Comment posted by Geir-Tore Lindsve
15 years ago.
Thanks for the response. I have found some places to do add the enableScrolling call which works, but not fully satisfied yet. Will try more places though.

Stupid ModalPopupExtender not having client side onshown event... ;)
Comment posted by Geir-Tore Lindsve
15 years ago.
Found a neat way to handle this when the calendar is inside a ModalPopupExtender:

<script type="text/javascript">
function pageLoad()
{
var mpe = $find("mpe");
mpe.add_shown(onShown);
}

function onShown()
{
dpc1.enableScrolling();
}
</script>

<ajaxtoolkit:modalpopupextender ........ behaviorId="mpe" ..... /
Comment posted by Dan Letecky
15 years ago.
Thanks for posting the solution!
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.