I have written a function to scroll a Gannt chart to today's date.
The sharepoint file jsgrid.js is registered SOD during init.js and includes the function "ScrollGanttToDate", which I need in my function.
I entered the script below in a script editor webpart, and get the error "Unable to get value of the property 'ScrollGanttToDate': object is null or undefined". The script jsgrid.js has also not loaded at this point.
My question is, why is the execution of my function not being delayed?
<script type="text/javascript">
$(function(){
SP.SOD.executeOrDelayUntilScriptLoaded(ScrollGanttToToday(),'jsgrid.js');
function ScrollGanttToToday(){
$("div [id$='_ListViewWebPartJSGrid']")[0].jsgrid.ScrollGanttToDate(new Date());
}
});
</script>
Any help would be greatly appreciated.