User Profile & Activity

David Williams Member

So that is what I was missing. So now wanting to do the same thing, I tried playing around with moving the Timeline view around. Not as easy, but I found that this works for me:

function WebScheduler1_OnAfterRenderView(controlId, viewMode) {
   var ws = ISGetObject("WebScheduler1");
   ws.ViewSettings.SelectedDate.setHours(8);
   var frm = ws.GetSchedulerTableFrame();

   if (viewMode == "Day" || viewMode == "Week") {
       var row = frm.rows[2].children[0].children[0].children[0].rows[16];
       row.scrollIntoView();
   } else if (viewMode == "Timeline") {
       window.setTimeout("scrollview()", 10);
   }
}
function scrollview() {
   var ws = ISGetObject("WebScheduler1");
   var frm = ws.GetSchedulerTableFrame();
   
   //this is the scrollable div
   var sdiv = frm.children[0].children[1].children[0].children[0].children[0].children[1].children[1].children[0];
  
   //grab the first cell in the table
   var cel = frm.children[0].children[1].children[0].children[0].children[0].children[1].children[1].children[0].children[0].children[1].children[0].cells[0];
  
   //based on the first cells width, multiply by the number of hours to scroll to the right (assuming the first cell is t0000)
   sdiv.scrollLeft = (cel.offsetWidth * 8);
}

I found I could not use the same scollIntoView function for some reason. And I also found I had to delay setting the scrollLeft as it would not work right in the OnAfterRender...  I would like to know if there is a better way to do this of course. The only bad part about this it is scrolls every time the user changes their view. If they change to Week and back to Timeline, they are no longer at the same point they were before. Some changes to this could correct for that though.

Glenn,

   Well that makes sense! I did not realize that was asynchronous. I made some slight changes, to call the original function only after the resource is set in the timeout function, or otherwise only if the resource is already selected.

var currentItemResourceCount;

function wbSave_OnClick() {
    var wr = ISGetObject("wcResources");

    //create and add a new resource if one is not selected (an existing event)
    if (wr.Value == "") {
        currentItemResourceCount = wr.Rows.length;
        ISGetObject("wiResourceName").SetValueData("New Resource");
        ISGetObject("wcResourcesColor").SetSelectedIndex(0);
        ISGetObject("wiRLocation").SetValueData("N/A");
        ISGetObject("wiRDescription").SetValueData("New Resource");
        WS_OnSaveResource();

        wr.UpdateUI();
        SetLatestResource();
    } else
WS_OnSave();
return true; } function SetLatestResource() { var wr = ISGetObject("wcResources"); if (wr.Rows[currentItemResourceCount] != null) { //Now select the new row ISGetObject("wcResources").Rows[wr.Rows.length - 1].Select(); //call original function WS_OnSave(); } else { setTimeout(function() { SetLatestResource(); }, 10); } }

Thanks so much for your help. It is really great to have this kind of flexibility with your control.

Glenn,

   Thanks for the response. Having the feature next month will be great. I was hoping the release wasn't going to be sometime early next year. I don't think we need to look into a workaround at this point. I do think it would be great if you could allow a custom template though. It would really open up the potential of using this control to manage meetings and have it look the way users want it to. What you have designed is great though and will work for our needs.

 

Thanks,
David

Here is what I did for the Day and Week view, but it does not work on the initial load - only after the user switches view or you/they click the same view button again...

function WebScheduler1_OnAfterRenderView(controlId, viewMode) {
   if (viewMode == "Day" || viewMode == "Week") {
      var ws = ISGetObject("WebScheduler1");
      var frm = ws.GetSchedulerTableFrame();
      var row = frm.rows[2].children[0].children[0].children[0].rows[16];
      row.scrollIntoView();
   }
}

It took a bit of trial and error and exploring a watch variable to figure out the path, but the rows element at the end is split into 48 parts (one for each half hour). So 16 is 8:00 AM which is what I wanted at the top. There may be an easier way to do it and I would like to know what it is, but that works for me in my case. I would also like to know how to make it work on the initial load. It seems as if the control is not displayed yet and therefore the scrollIntoView call does not take effect.

Good Luck,
David

Ok I should have read the FAQ first! I was trying to do things by hand instead of using the option "Register SmartWebResources" which does this work for you not to mention correctly. It looks like the only difference is I was missing the handler in the system.webserver section. It is working fine now.

This is good news. What is the timeframe for releasing v3? If not soon, is there a possible workaround such as having two instances of the control with one showing the following 10 days, etc. where it would look close to being a continuous list (IE not repeat the header information and navigation buttons)?

 

I would also like to know if it is possible to customize the Agenda View layout such as having the start time next to the date include the end time also like in the details? I noticed there is a "Custom" for the SelectedViewMode property, but I could not find any documentation on how to use it. It is not listed in the custom templates which is where I would have expected it to be.

Posted: August 25, 2009 10:45 AM

That worked. Thank you very much!

All times are GMT -5. The time now is 10:50 AM.
Previous Next