232
Views
3
Comments
Solved
React to Javascript Event
Question

Hi,

I'm currently trying to use Vis.JS Timeline. Part of my solution is allowing users to manipulate the data on the timeline and for that I need to be able to use the events in my application. Is there a way to do this? Can I map Javascript events to screen or server actions (this seem strange though) for example? I tried finding any documentation about this and search the forums but couldn't find any information about this.

Event examples: https://visjs.org/examples/timeline/interaction/eventListeners.html

Thanks,

Vincent

2019-09-17 09-11-00
João Pedro Abreu
Staff
Solution

Hi Vincent,

I assume you're building a web app, and not a mobile app, since this would be easy in a mobile app.

On a web app, you can place a web block from RichWidgets called FakeNotify and then use a platform javascript function OsNotify(webBlockId, message) to trigger a screen action.

I hope this helps.

2020-09-21 08-42-47
Vincent Koning

Hi Joao,

It's indeed for a web app. I'll look into it, thanks for the suggestion.



2020-09-21 08-42-47
Vincent Koning


I have been able to use the "FakeNotify" together with the "Deprecated_NotifyGetMessage" to hook into javascript events. Thanks, this really solved a big issue for me :) 

Example for visjs Timeline. This needs to be loaded in your current screen;

  1. Drop the FakeNotify block in your screen and name it VisJSEvents
  2. Create the javascript show in the screenshot and put that into a "RunJavaScript" server action in the preparation flow;
  3. Create an OnNotify flow with the "Deprecated_NotifyGetMessage" server action and do your magic there.

That's it.  I does scare me a bit that the bits that I now need to use are Deprecated and I wasn't able to find new versions available. Lets hope that this doesn't cause any issues in the upcoming versions.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.