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

Include highlight elements in select callback arg #7644

Open
2 tasks done
joelstein opened this issue Mar 30, 2024 · 3 comments
Open
2 tasks done

Include highlight elements in select callback arg #7644

joelstein opened this issue Mar 30, 2024 · 3 comments
Labels
Date Point/Select Date (and Time) selection with mouse, or other mouse actions over dates like hovering Discussing

Comments

@joelstein
Copy link

joelstein commented Mar 30, 2024

Checklist

  • I've already searched through existing tickets
  • Other people will find this feature useful

Is this feature for a specific connector (React/Angular/etc)?

Other

Feature Description

It would be handy to include an el prop in the select callback so we can easily access the highlight (or mirror) dom element and do things like attach it as a reference for a Floating UI popover.

This would also be consistent with how the dateClick callback behaves.

I'm aware that I can find it at info.jsEvent.target. However, for some reason, that's less reliable than a dedicated DOM reference.

@joelstein
Copy link
Author

I guess what I'm looking for is something like this.

  • eventClick includes an el prop
  • dateClick includes a dayEl prop
  • select does not include an element prop

Is there a reason for this?

I installed the source locally but could not figure out how to use the source code to build a pull request.

@acerix
Copy link
Member

acerix commented Apr 5, 2024

It's possible for a selection to be multiple elements (e.g. by selecting 2 weeks) which may be why using target doesn't work as expected, but I can see how it could be useful to include the elements in the argument.

For now, it may work better to get the elements using the fc-highlight class like this:

https://codepen.io/acerix/pen/YzMedGP?editors=0011

@acerix acerix changed the title Include "el" prop in select callback Include highlight elements in select callback arg Apr 5, 2024
@acerix acerix added Discussing Date Point/Select Date (and Time) selection with mouse, or other mouse actions over dates like hovering labels Apr 5, 2024
@rock77217
Copy link

rock77217 commented May 27, 2024

I have same problem. I'm using React connector.

I'd like to change the selection time grid's background color dynamically.
I tried to get element when select trigger like below:

const handleSelect = (arg: DateSelectArg) => {
  calendarRef.current.calendar.el.querySelectorAll(".fc-highlight").forEach((el: any) => {
    el.style.background = "green";
  })
};

But it's not work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Date Point/Select Date (and Time) selection with mouse, or other mouse actions over dates like hovering Discussing
Projects
None yet
Development

No branches or pull requests

3 participants