JavaScript Access to currently selected item in <rich:listSh
elridge Oct 5, 2009 3:43 PMHello,
I hope this is the correct place this type of question.
I am using richfaces 3.1.5. I am trying to figure out how to access (via JavaScript) the currently selected item(s) in the source/target lists in the <rich:listShuttle > component?
As an example, I want to be able to fire a JavaScript reporting call onCopyClick in the listShuttle component. I do not know how (if it is possible) to access the selected item(s) from the source or target lists in JavaScript.
In the code example below, I wish to be able to make a call like:
oncopyclick="dcsMultiTrack('DCSext.dctag2','Columns','DCSext.dctag3', 'Add', 'DCSext.dctag4', '[currently selected item(s)]');"
I need to know with what to replace '[currently selected item(s)]' in the call above.
<a4j:form id="tabcatColumnPicker"> <rich:listShuttle sourceValue="#{toolBar.freeItems}" targetValue="#{toolBar.items}" var="items" sourceCaptionLabel="#{msgs.AvailableColumns}" targetCaptionLabel="#{msgs.CurrActiveColumns}" converter="listShuttleconverter" id="tabcatListShuttleColumns" copyControlLabel="#{msgs.Add}" copyAllControlLabel="#{msgs.AddAll}" removeControlLabel="#{msgs.Remove}" removeAllControlLabel="#{msgs.RemoveAll}" topControlLabel="#{msgs.Top}" upControlLabel="#{msgs.Up}" downControlLabel="#{msgs.Down}" bottomControlLabel="#{msgs.Bottom}" sourceListWidth="350" targetListWidth="350" listsHeight="250" oncopyallclick="dcsMultiTrack('DCSext.dctag2','Columns','DCSext.dctag3', 'Add All', 'DCSext.dctag4', 'None');" onremoveallclick="dcsMultiTrack('DCSext.dctag2','Columns','DCSext.dctag3', 'Remove All', 'DCSext.dctag4', 'None');" oncopyclick="dcsMultiTrack('DCSext.dctag2','Columns','DCSext.dctag3', 'Add', 'DCSext.dctag4', '[currently selected item(s)]');" > <rich:column> <h:outputText value="#{items.label}"></h:outputText> </rich:column> </rich:listShuttle> <a4j:commandButton value="#{msgs.Ok}" reRender="tabcatPageHeadingControlBar,tabcatFilterTable,tabcatFilterForm,tabcatColumnPickerPanel,tabcatNumResults,tabcatPagingTop,tabcatProductsTableForm,tabcatPagingBottom,niWdSimpleFeedbackForm" onclick="showLoadingMessage();" oncomplete="dcsMultiTrack('DCSext.dctag2','Columns','DCSext.dctag3', 'Selected Columns', 'DCSext.dctag4', '#{toolBar.itemsStr}'); hideLoadingMessage();" /> </a4j:form>
Please Note: the data for the source and target lists is generated by use of a <rich:column> component within the <rich:listShuttle> component.
Is it even possible in this version of richfaces (3.1.5) to access the desired value via JavaScript? Any and all help would be appreciated!
Thanks,
Elridge