We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Scheduler: ScrollTo on created with resources

Hi,

I'm trying to set the scrollTo time on creation of the schedule object so I have this:

ejs-schedule id="Schedule" ref="scheduleObj" width='100%' height='550px' :created="onCreated" :selectedDate="selectedDate"
                      :eventSettings='eventSettings' :group='group'>
            e-views>
               e-view option="Week"> /e-view>
            /e-views>
            e-resources>
                e-resource field='ConferenceId' title='Attendees' name='Conferences' :allowMultiple='allowMultiple' :dataSource='resourceDataSource'
                            textField='Text' idField='Id' colorField='Color'>
                /e-resource>
            /e-resources>
        /ejs-schedule>
(< symbols removed)

The onCreated method
onCreated: function(args) {
            this.$refs.scheduleObj.scrollTo('18:00')
        },

And the error I get: 
TypeError: Cannot read property 'scrollToHour' of undefined
    at Schedule.scrollTo (schedule.js?67fb:1100)
    at VueComponent.ScheduleComponent.scrollTo (schedule.component.js?7a88:245)
    at VueComponent.onCreated (Calendar2.vue?5052:577)
    at Observer.notify (observer.js?6607:89)
    at Schedule.Base.trigger (base.js?54ff:149)
    at VueComponent.ScheduleComponent.trigger (schedule.component.js?7a88:61)
    at Schedule.Component.appendTo (component.js?02b4:131)
    at VueComponent.ComponentBase.mounted (component-base.js?3cd2:42)
    at callHook (vue.common.js?2371:2923)
    at Object.insert (vue.common.js?2371:4160) 

When I remove the Resources tag the scrolling is working fine. Anyone an idea?

Edit: when I set a Timeout it works:
 onCreated: function(args) {
            const self = this
            setTimeout(function() {
                // In timeout otherwise with resource view it wont work
                self.$refs.scheduleObj.scrollTo('18:00')
            }, 500)
        },



3 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team February 19, 2019 10:08 AM UTC

 
Thank you for contacting Syncfusion support. 
 
In resource sample, promise will be resolved slower compared to default sample. Therefore, only unable to get the Schedule instance in created event which is the cause for the issue. Kindly use dataBound event as below. 
 
:dataBound="onDataBound" 
 
flag: true, 
 
onDataBound: function(args) { 
      if (this.flag) { 
        this.$refs.scheduleObj.scrollTo("18:00"); 
        this.flag = false; 
      } 
    } 
 
 
Regards, 
Karthigeyan 
 



AR Arwin February 19, 2019 01:45 PM UTC

Thank you Karthigeyan, this is working!


KK Karthigeyan Krishnamurthi Syncfusion Team February 20, 2019 03:53 AM UTC

 
We are happy that our solution fulfilled your requirement. 
 
Regards, 
Karthigeyan 


Loader.
Live Chat Icon For mobile
Up arrow icon