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

Schedule not found while it exists

Hi,

I'm getting this error while trying to refresh my schedule control: Version 13.2.39
Uncaught ejSchedule: methods/properties can be accessed only after plugin creation
Error: ejSchedule: methods/properties can be accessed only after plugin creation
    at t.throwError (eval at <anonymous> (http://localhost:50498/Scripts/jquery-1.10.2.min.js:21:4994), <anonymous>:10:22808)
    at n.fn.(anonymous function) [as ejSchedule] (eval at <anonymous> (http://localhost:50498/Scripts/jquery-1.10.2.min.js:21:4994), <anonymous>:10:17521)
    at filtersuccess (http://localhost:50498/Home:205:38)
    at Object.onDialogClose (http://localhost:50498/Home:259:6)
    at Object.t.widgetBase._trigger (http://localhost:50498/Scripts/ej/ej.web.all.min.js:10:10945)
    at HTMLDivElement.<anonymous> (http://localhost:50498/Scripts/ej/ej.web.all.min.js:10:697508)
    at HTMLDivElement.r.complete (http://localhost:50498/Scripts/jquery-1.10.2.min.js:23:25585)
    at c (http://localhost:50498/Scripts/jquery-1.10.2.min.js:21:26036)
    at Object.p.fireWith [as resolveWith] (http://localhost:50498/Scripts/jquery-1.10.2.min.js:21:26840)
    at l (http://localhost:50498/Scripts/jquery-1.10.2.min.js:23:19765)


My schedule code looks like this:
<div id="schedule" class="waiting">
    @(Html.EJ().Schedule("Schedule1")
      .Width("100%")
      .Height("650px")
      .AllowKeyboardNavigation(true)
      .Locale("en-US")      
              .IsResponsive(true)       
    .AllowDragDrop(false)
    .ShowTimeScale(false)    
       .ContextMenuSettings(menu => menu.Enable(true))
    .CurrentView(CurrentView.Month)
    .EnableLoadOnDemand(true)
    .ScheduleClientSideEvents(eve => eve.CellDoubleClick("onOpen"))
            .ScheduleClientSideEvents(eve => eve.AppointmentHover("recordDetails"))
                             .ScheduleClientSideEvents(eve => eve.CellHover("recordDetails"))
                                .ScheduleClientSideEvents(eve => eve.Create("filters"))
                                .ScheduleClientSideEvents(eve => eve.CellClick("cell"))
                            .ScheduleClientSideEvents(eve => eve.AppointmentClick("onAppointmentClick"))                        
                .ScheduleClientSideEvents(eve => eve.BeforeContextMenuOpen("popCustomContextMenu"))
 .AppointmentSettings(fields => fields.Datasource(ds => ds.URL(Url.Action("GetData", "Home")).Adaptor(AdaptorType.UrlAdaptor))
    .Id("Id")
    .Subject("Subject"))   
     .ShowAllDayRow(false))
    

and I'm trying to do a refresh after a dialog has closed:
 var schObj = $("#Schedule1").ejSchedule("instance");
        schObj.refresh();
This works perfectly after clicking a certain button but throws an error when i call the refresh after dialog close.



I need this sorted ASAP


4 Replies

FA Fanisa December 11, 2015 05:55 AM UTC

I managed to store the scheduler in an observable and tried to refresh it but then it refreshes and doesn't display any data. upon inspecting model,there are no differences between the one that displays data after creation and the one that displays nothing after refresh


 var scheduletwo=ko.observable();
scheduletwo($("#Schedule1").data("ejSchedule"));

Later I use it(since #Schedule1").data("ejSchedule is undefined at this point):
scheduletwo().refresh();


The scheduler refreshes but has no data at all:(


KK Karthigeyan Krishnamurthi Syncfusion Team December 11, 2015 02:23 PM UTC

Hi Fanisa,

Thanks for contacting Syncfusion support.

Please find the following responses for your queries.

Query1: Script error throws while refreshing the scheduler

We have analyzed your provided code example and suspect that you have created the object for the Schedule control before the control is rendering. Therefore, we request you to create an object for schedule once the control is rendered in order to avoid the reported script error.

Query2: Appointments are not displaying after refreshing the scheduler

We suspect that the reason for the above mentioned issue is scheduler fields are not mapped properly. In order to render the appointments with in the scheduler we need to map the StartTime, EndTime fields as they are mandatory fields. In the provided code example only Id and Subject fields are mapped. Therefore, we request you to map the starttime and endtime fields in order to render to the appointments in scheduler control. Kindly refer the below UserGuide Link in order to know more about scheduler fields.

UG Link:
http://help.syncfusion.com/js/schedule/data-binding


Regards,
Karthigeyan



FA Fanisa December 14, 2015 08:04 AM UTC

Query2: Appointments are not displaying after refreshing the scheduler

We suspect that the reason for the above mentioned issue is scheduler fields are not mapped properly. In order to render the appointments with in the scheduler we need to map the StartTime, EndTime fields as they are mandatory fields. In the provided code example only Id and Subject fields are mapped. Therefore, we request you to map the starttime and endtime fields in order to render to the appointments in scheduler control. Kindly refer the below UserGuide Link in order to know more about scheduler fields.
This is certainly not the case as i put the fields back and it still didn't work. I'm thinking it has something to do with the fact that the dialog I pop is a partial view which has it's own scripts.

Query1: Script error throws while refreshing the scheduler

We have analyzed your provided code example and suspect that you have created the object for the Schedule control before the control is rendering. Therefore, we request you to create an object for schedule once the control is rendered in order to avoid the reported script error.
Where is the code??


VS Velmurugan S Syncfusion Team December 15, 2015 12:33 PM UTC

Hi Fanisa,

Sorry for the inconvenience caused.

We have analyzed further about the reported problem by preparing the sample with your given code example (view page, script). We have prepared the MVC sample and used your view page code in the index.cshtml and the script code within the $(document).ready(function(){}), then run the sample and able to reproduce the mentioned issue. The reason for the issue is “ the html helper of our control script is rendering in the page after the refresh method script”. Please refer to the following screenshot of the script appending in page (page source screenshot).



Therefore, we suspect that similar behavior has happened at your end. So, we request you to call the schedule refresh method after the html helper script appending. For example we have prepared the following sample to overcome the issue by using the “$(window).load(function(){})”, which can be downloaded from the location.

http://www.syncfusion.com/downloads/support/forum/121403/ze/SampleSchedule-470090497

Please try the above sample, if issue persists, revert with reproducing the issue in the above sample or  share some more information like complete code example( view page, controller page ), and which dialog close you are mentioning in your query or issue reproducing sample if possible. So that we can analyze those scenarios and provide you the possible solution.

Regards,
Velmurugan


Loader.
Up arrow icon