Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing/toggling classes in timeline items #1790

Open
erevodifosin opened this issue Apr 29, 2024 · 0 comments
Open

Changing/toggling classes in timeline items #1790

erevodifosin opened this issue Apr 29, 2024 · 0 comments

Comments

@erevodifosin
Copy link

Hello,

I was trying to change/toggle some classes on the timeline items in the runtime in order to upgrade the UX but it is a bit weird the way I managed to achieve it.
First of all in some items I use "className": "cancelled" which adds the corresponding class in the element.
The task is to toggle the specific class in the selected item. I was not able to find something related in the documentation.

I tried the below with a bit of success but then when I click somewhere else the toggle is reverted.

temp = document.getElementsByClass("vis-selected")
temp[0].classList.toggle("cancelled");

The workaround I managed to figure out was to remove the class name in my db and then reload the items of the timeline.
Am I missing something here or my workaround is the only solution for the moment?
It would be nice to have a method to toggle a class in the items in runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant