User Profile & Activity

neil mc Member

Thanks very much guys for all of your help on this, I think i've got something that's working for me now thanks to your suggestions.  I was struggling with the scollIntoView function as well in the timeline view but the using the scrollLeft on the div does the trick. 

The code below works for me in the OnAfterRenderView event without the need for the delay call, not sure why that should be?  The only difference between the script i'm using is that i'm selecting the hour cell directly rather than selecting the first hour cell and mulitplying up (but either approach works for me). 

function WebScheduler1_OnAfterRenderView(controlId, viewMode) {
            if (viewMode == "Timeline") {
                // Get default hour
                var now = new Date();
                var hour = now.getHours();
                if (hour > 2) {
                    hour = hour - 2 
                };
                
                // Get web schedule object
                var ws = ISGetObject("WebScheduler1");
                // Set selected hour
                ws.ViewSettings.SelectedDate.setHours(hour);
                // Get web schedule table frame
                var frm = ws.GetSchedulerTableFrame();
                
                // Get the scrollable div
                var sdiv = frm.children[0].children[1].children[0].children[0].children[0].children[1].children[1].children[0];
                // Select hour cell
                var cell = frm.rows[1].children[0].children[0].children[0].rows[0].children[1].children[0].children[0].children[1].rows[1].cells[hour];
                
                // Scroll
                if (sdiv != null && cell != null) {
                    sdiv.scrollLeft = cell.offsetLeft;
                }
            }
        }

Thanks again for your help with this

Neil

All times are GMT -5. The time now is 6:53 PM.
Previous Next