Our pure JavaScript Scheduler component


Post by abandara »

Hi ,
I have tried to implement drag between schedulers in typescript. But I got the following errors when I try to set the partner.
    Which says (Property 'partner' does not exist on type 'Scheduler'.ts(2339)).
    bryntum-typescript.JPG
    bryntum-typescript.JPG (48.89 KiB) Viewed 1714 times
      Another error pops up (Cannot find name 'bryntum'.ts(2304)). I have disabled the tslint, but no luck.
      bryntum-typescript2.JPG
      bryntum-typescript2.JPG (44.16 KiB) Viewed 1714 times
      .

      We got one license under this email.(gary.semple@pronto.net) I don't know this license provides technical support.I can download the build but cant submits the bugs in the forum.If you can give us a lead, that would be highly appreciated.

      Post by mats »

      Which version are you using? Can you please upload a test case we can inspect?

      Post by abandara »

      Hi,
      Thanks for the reply. I have used version "scheduler-2.0.3" build. Please find the attached sample project which I have newly created. This sample gives the same errors which I have mention earlier.
      react-typescript-schedular-partner-sample.zip
      (2.72 MiB) Downloaded 122 times
      Fix this issue is really important for us to go forward. Thanks again.

      Here I have attached the console log.
      bryntum-typescript3.JPG
      bryntum-typescript3.JPG (238.76 KiB) Viewed 1693 times

      Post by saki »

      There are some small things you should do:
      1. add declare const bryntum; to the top of BottomSchedularPartner.ts
      2. in the same file change all occurrences of scheduler.partner -> scheduler['partner']
      This should fix typescript problems. I'm still getting error Can't resolve 'source-map-loader' though, but it doesn't seem to be related to the Scheduler.

      I hope this info helps you to move forward.

      Post by abandara »

      Hi Saki,
      Thanks for the reply.
      I did the code changes that you suggested and it removes typescript errors as you say. But that will not fix the real issue.
      For me, the real issue is not creating a partner instance.
      The partner instance get by using the following statement and it's used mysterious "bryntum" global variable where I can't find. I don't think this will fix by just declare the "bryntum" variable.
      error1.JPG
      error1.JPG (51.43 KiB) Viewed 1674 times
      As i mentioned earlier, "set partner(partner){}" method try to set the partner attribute of the "Scheduler" object.But I cant find such a property in Scheduler.d.ts file.Its only contains "addPartner()" and "removePartner()" metods in "Scroller" class which related to "partner". Am I missing something here?
      error3.JPG
      error3.JPG (78.89 KiB) Viewed 1674 times
      error2.JPG
      error2.JPG (109.94 KiB) Viewed 1674 times
      As you said, Can't resolve 'source-map-loader' error doesn't relate to the scheduler. It's related to the package which I have to installed and it was fixed with the current sample code.

      Your guidance highly appreciated.Thanks again.

      Post by abandara »

      Hi Saki,
      Please find the sample code here.
      react-typescript-schedular-partner-sample.zip
      (2.72 MiB) Downloaded 140 times
      Best regards,
      Anuradha

      Post by saki »

      I'll explain what's going on behind the scenes:
      • partner property accepts the existing other instance of the scheduler to pair with
      • to be able to pass string id of the other scheduler as partner value we need to get the instance from the id. In javascript React example we override the default getter for the bottom Scheduler to also accept the string id with which it tries to get the instance of the other scheduler
      • bryntum is a global variable that can be used to get the instance from id as you can see in the getter override in the bottom scheduler
      • it can be a problem of timing because if the instance with the specified id does not yet exist then the whole setup cannot work
      • errors of type: propName does not exist on type something are caused by restrictions of TypeScript that insists on types to be declared before they can be used
      • it may be necessary to create a new type file for bottom Scheduler with partner property declared to satisfy the TypeScript requirements
      I hope the above will move you forward.

      TypeScript is not native for React so there may be some initial difficulties especially when porting loosely coded existing javascript code to the strict typescript environment.

      Post by abandara »

      Hi Saki,
      Thanks for the reply.
      • First a fall, The react typescript sample wrapper class doesn't contain the required code that needs to create a partner instance. So we have added it.
      partner-instance.JPG
      partner-instance.JPG (20.83 KiB) Viewed 1642 times
      • "bryntum" variable does not available when the schedulers initialized. Still, "bryntum" bind to the window object. We can access bryntum variable as a property of the window object. Dot notation gives a compile error.
      So here is the corrected code. Thanks again for the support.
      partner-instance2.JPG
      partner-instance2.JPG (21.38 KiB) Viewed 1642 times

      Post by pmiklashevich »

      Hello Anuradha,

      Please confirm that your issue is solved.

      Thanks,
      Pavel

      Pavlo Miklashevych
      Sr. Frontend Developer


      Post by abandara »

      Hi Pavel,
      Yes.Its been solved.
      Regards,
      Anuradha

      Post Reply