Skip to content

Commit

Permalink
TheCoder4eu/BootsFaces-OSP#916 added the "event" parameter for Firefo…
Browse files Browse the repository at this point in the history
…x compatibility
  • Loading branch information
stephanrauh committed Feb 21, 2018
1 parent 55918d3 commit a57202d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/webapp/forms/RemoteCommand.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
class="brush: xml; toolbar: false;gutter: false; first-line: 1">
<![CDATA[
<b:panel title="RemoteCommand demo">
<b:button onclick="countRemotely()" value="increment remote counter" look="success"/>
<b:button onclick="countRemotely(event)" value="increment remote counter" look="success"/>
<b:remoteCommand name="countRemotely" id="remoteCommand" actionListener="&num;{remoteCommandBean.count}" update="@(.counter)" />
<h:panelGroup id="counterId" layout="block" class="counter">
<br />
Expand Down Expand Up @@ -79,7 +79,7 @@
</b:tab>
<b:tab title="live demo">
<b:panel title="RemoteCommand demo">
<b:button onclick="countRemotely()" value="increment remote counter" look="success"/>
<b:button onclick="countRemotely(event)" value="increment remote counter" look="success"/>
<b:remoteCommand name="countRemotely" id="remoteCommand" actionListener="#{remoteCommandBean.count}" update="@(.counter)" />
<h:panelGroup id="counterId" layout="block" class="counter"><br />You've triggered the remoteCommand #{remoteCommandBean.counter} times.</h:panelGroup>
</b:panel>
Expand All @@ -95,15 +95,21 @@
<li><code>&lt;b:remoteCommand name="setCounter" parameters="initialValue,step" /&gt;</code> generates the JavaScript function <code>setCounter(initialValue,step)</code>.</li>
</ul>

<h2><a id="parameters">Implicit parameter "event"</a></h2>
<p>The last parameter is always the <code>event</code>. This parameter is added automatically to the parameter list. It's necessary to
call an AJAX request and it's useful in many other situations. It's a good idea to pass the <code>event</code> when you're calling
the function, even though the AJAX engine usually also works without it. In this case, the event passed to the AJAX engine is
<code>undefined</code>, which may or may not cause problems.</p>

<h:form>
<b:tabView active-index="2">
<b:tab title="JSF code">
<b:well>
<script type="syntaxhighlighter"
class="brush: xml; toolbar: false;gutter: false; first-line: 1">
<![CDATA[
<b:button onclick="setCounter(0)" value="set counter to zero" look="success"/>
<b:button onclick="setCounter(10)" value="set counter to ten" look="success"/>
<b:button onclick="setCounter(0, event)" value="set counter to zero" look="success"/>
<b:button onclick="setCounter(10, event)" value="set counter to ten" look="success"/>
<b:remoteCommand name="setCounter" id="remoteCommand2"
actionListener="&num;{remoteCommandBean.setCounter}"
update="@(.counter)" parameters="initialValue" />
Expand Down Expand Up @@ -152,8 +158,8 @@
</b:tab>
<b:tab title="live demo">
<b:panel title="RemoteCommand demo">
<b:button onclick="setCounter(0)" value="set counter to zero" look="success"/>
<b:button onclick="setCounter(10)" value="set counter to ten" look="success"/>
<b:button onclick="setCounter(0, event)" value="set counter to zero" look="success"/>
<b:button onclick="setCounter(10, event)" value="set counter to ten" look="success"/>
<b:remoteCommand name="setCounter" id="remoteCommand2" actionListener="#{remoteCommandBean.setCounter}" update="@(.counter)" parameters="initialValue" />
<h:panelGroup id="counterId" layout="block" class="counter"><br />You've set the remoteCommand counter to #{remoteCommandBean.counter}.</h:panelGroup>
</b:panel>
Expand Down

0 comments on commit a57202d

Please sign in to comment.