0

I don't even know if this is possible.

I have a Javascript widget (fyi, an interactive calendar) which I like to use for its functionality (there are some things that the Primefaces calendar doesn't have, for instance, a badge in each day counting the number of events in that day, etc.) but I'd like now to use it in my JSF project.

The case is, when I click on a day, a panel is displayed showing the details of that day events, with a link for more details, in case that day has events. If the day doesn't have events, the click on that day will open a new form to create an event in that specific day.

The problem is that this is only done by Javascript events, and I'd wish to load that panel with only the events of that specific day, with the proper links to it. I thought that there was a way to render a <h:commandLink> directly from the Javascript code, but it looks like it's not the case.

Does anyone have a better solution for this?

Joao Arruda
  • 223
  • 2
  • 9
  • In JSF the rendering happens in the server side, so you need either to have them all rendered and show the one you want at client side or perform an asynchronous (ajax) call in order to get the code piece you want rendered. Basically, as the answer states. – Aritz Oct 15 '15 at 20:07

1 Answers1

2

Consider p:remoteCommand from PrimeFaces as a possible solution. Something like:

<h:form>
    <p:remoteCommand name="rc" update="yourCommandLinkId" />
    <input type="button" onclick="rc()" value="Submit" />
</h:form>

You can also call a Javascript AJAX function directly. See this question for an example

Community
  • 1
  • 1
olexd
  • 1,360
  • 3
  • 13
  • 26
  • This is it! The `` was beautiful for my case, I just modified your solution using Primefaces Extensions, as to set parameters to my method, and I had to discover how to convert them from Javascript to Java, but after that it was easy: ` ` – Joao Arruda Oct 16 '15 at 22:07