[
https://jira.jboss.org/browse/RF-8270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12534209#action_12534209
]
Ian Springer commented on RF-8270:
----------------------------------
The attribute is useful, because then the component can gray out the button and
not allow the user to even click it if the correct number of rows is not
selected. That is better than allowing the user to click the button and then
failing the check and returning an error (e.g. "at least two items must be
selected!") to the user. Or were you suggesting using JavaScript hooks to do
the check just prior to submitting the AJAX request? This would work, but
hacking my own JavaScript is not desirable, when the component could provide
the functionality for me.
> provide a way to render a commandButton based on a minimum and/or maximum
> number of rows currently selected in a rich:*dataTable
> --------------------------------------------------------------------------------------------------------------------------------
>
> Key: RF-8270
> URL: https://jira.jboss.org/browse/RF-8270
> Project: RichFaces
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: component-tables
> Affects Versions: 3.3.2.SR1
> Reporter: Ian Springer
> Assignee: Anton Belevich
> Fix For: 4.0.0.Milestone1
>
>
> This is useful when a particular action only makes sense when a certain
> number of rows are selected - here are a few examples:
> 1) most CRUD actions only make sense when at least one row is selected
> 2) a diff/compare action would only make sense when at least two rows were
> selected
>
> For RHQ, we currently have a custom component for this but would prefer use
> something that was built-in to RichFaces. Here's what the usage of our
> component (onc:selectCommandButton) looks like (not the low and high
> attributes, which reflect the minimum and maximum rows that must be selected:
> <f:facet name="footer">
> <rich:columnGroup>
> <rich:column colspan="4" width="100%">
> <onc:selectCommandButton
> action="#{ResourceGroupOperationScheduleUIBean.unschedule}"
> value="UNSCHEDULE"
> target="selectedItems"
> styleClass="on-pager-button
> buttonsmall"
> low="1"
>
> rendered="#{ResourceGroupUIBean.permissions.control}"/>
> <onc:selectCommandButton
> action="#{ResourceGroupOperationScheduleUIBean.executeNow}"
> value="EXECUTE NOW"
> target="selectedItems"
> styleClass="on-pager-button
> buttonsmall"
> low="1" high="1"
>
> rendered="#{ResourceGroupUIBean.permissions.control}"/>
> </rich:column>
> </rich:columnGroup>
> </f:facet>
> However, I think a nicer way to implement this would be to add a new optional
> attribute to the rich:*dataTable components, e.g.:
> <rich:extendedDataTable selectedRowCount="#{MyManagedBean.selectedRowCount}"
> ... />
> The extendedDataTable component would update this attribute any time the
> selection is changed by the GUI user. Then a standard commandButton could be
> used as follows:
> <h:commandButton value="MyAction" rendered="#{MyManagedBean.selectedRowCount
> eq 1}" .../>
> An alternative to a new 'selectedRowCount' attribute would be using the
> existing 'selection' attribute and adding a new getSelectedRowCount() method
> to the org.richfaces.model.selection.Selection interface that the 'selection'
> attribute updates. An example of what this option would look like:
> <rich:extendedDataTable selection="#{MyManagedBean.selection}" ... />
> <h:commandButton value="MyAction"
> rendered="#{MyManagedBean.selection.selectedRowCount eq 1}" .../>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues