-
1. Re: open a context-menu on inputText by right-click ?
ilya_shaikovsky Jan 13, 2010 11:35 AM (in response to fdegrigny)<h:inputText id="input"></h:inputText><rich:contextMenu event="oncontextmenu" attachTo="input" submitMode="none"><rich:menuItem value="menu item" ></rich:menuItem></rich:contextMenu>checked and works fine for me. -
2. Re: open a context-menu on inputText by right-click ?
fdegrigny Jan 14, 2010 4:44 AM (in response to ilya_shaikovsky)I am using a rich:componentControl because my inputs are in a dataTable and I dont want to repeat the context menu on each rows.
The trick is don't forget to define the 'attachTo' attribute to be notified by the 'oncontextmenu' event. :
<rich:contextMenu attached="false" id="menu" submitMode="server" disableDefaultMenu="true">
<rich:menuItem ajaxSingle="false" actionListener="#{myBean.copyValue}" >
Copy cell value to selected rows
<a4j:actionparam name="colCode" value="{colCode}"/>
<a4j:actionparam name="rowIndex" value="{rowIndex}"/>
</rich:menuItem>
</rich:contextMenu><rich:scrollableDataTable var="item" binding="#{myBean.dataTable}" value="#{myBean.products}"
<rich:columns value="#{myBean.colDecriptors}" var="col" >
<f:facet name="header">
<h:outputText value="#{col.label}" />
</f:facet>
<h:inputText id="#{col.propName}_input" value="#{item[col.propName]}" >
<rich:componentControl event="oncontextmenu" for="menu" operation="show" attachTo="#{col.propName}_input">
<f:param value="#{myBean.dataTable.rowIndex}" name="rowIndex"/>
<f:param value="#{col.propName}" name="colCode"/>
</rich:componentControl>
</h:inputText></rich:columns>
</rich:scrollableDataTable>
What have confused me is that the 'onclick' an 'ondblclick' events work well without the 'attachTo' attribute.
-
3. Re: open a context-menu on inputText by right-click ?
ilya_shaikovsky Jan 14, 2010 9:13 AM (in response to fdegrigny)if attached not defined - componetn control tried to be encoded as a4j:support directly to parent attribute. And input does not supports oncontextmenu