-
1. Re: listShuttle values are not resetting......
ilya_shaikovsky Nov 18, 2008 7:05 AM (in response to javamaverik)show the code you using please.
-
2. Re: listShuttle values are not resetting......
javamaverik Nov 19, 2008 1:32 AM (in response to javamaverik)<?xml version="1.0" encoding="ISO-8859-1" ?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:c="http://java.sun.com/jstl/core" xmlns:ui="http://java.sun.com/jsf/facelets" version="2.0"> <ui:composition> function reset(){ document.getElementById('custDetailsEditFrm:custName')='#{custDetailsEditMBean.name}'; document.getElementById('custDetailsEditFrm:purgeDys')='#{custDetailsEditMBean.purgeDays}'; document.getElementById('custDetailsEditFrm:comment')='#{custDetailsEditMBean.comment}'; document.getElementById('custDetailsEditFrm:status')='#{custDetailsEditMBean.status}'; document.getElementById('custDetailsEditFrm:ext_timings')= #{custDetailsEditMBean.newCutOffs}; #{rich:component('ext_timings')}.copyAll(); } </script> <fieldset class="panel_fieldset"><legend class="panel_legend"> Basic Details</legend> <div style="height:500px;" class="panel-container"><f:view> <a4j:form id="custDetailsEditFrm"> <table width="90%" cellpadding="5" cellspacing="5"> <tr> <td><h:outputLabel value="Name" style="font-weight:bold" for="custName" /><em style="color:red">*</em></td> <td><h:inputText id="custName" value="#{custDetailsEditMBean.name}" style="width:250px;"/></td> <td><h:outputLabel style="font-weight:bold" value="Purge Days" for="purgeDys" /></td> <td><rich:inputNumberSpinner enableManualInput="false" id="purgeDys" value="#{custDetailsEditMBean.purgeDays}"></rich:inputNumberSpinner> </td> </tr> <tr> <td><h:outputLabel style="font-weight:bold" value="Comment" for="comment" /></td> <td><h:inputTextarea id="comment" value="#{custDetailsEditMBean.comment}" style="width:250px;" rows="4" /></td> <td align="left"><h:selectOneRadio id="status" style="font-weight:bold" layout="pageDirection" value="#{custDetailsEditMBean.status}"> <f:selectItem itemLabel="Active" itemValue="Active" /> <f:selectItem itemLabel="Inactive" itemValue="Inactive" /> </h:selectOneRadio></td> </tr> <tr> <td colspan="4" align="center"><rich:panel header="Extraction Time"> <rich:listShuttle id="ext_timings" orderControlsVisible="false" fastOrderControlsVisible="false" sourceValue="#{custDetailsEditMBean.availableCutOffs}" targetValue="#{custDetailsEditMBean.newCutOffs}" var="cutOff" listHeight="300" listWidth="300" sourceCaptionLabel="Available Times" targetCaptionLabel="Selected Times"> <rich:column> <h:outputText value="#{cutOff}:00"></h:outputText> </rich:column> </rich:listShuttle> </rich:panel></td> </tr> <tr align="center"> <td colspan="4"><a4j:commandButton reRender="treeForm:customerTree" accesskey="S" onmouseover="goLite(this.form.name,this.name)" onmouseout="goDim(this.form.name,this.name)" style="width:80px" styleClass="visionBtn" id="saveCustInfo" value="Save" action="#{custDetailsEditMBean.save}"> <f:param name="saveRequest" value="true" /> </a4j:commandButton> <rich:spacer width="3px;"/> <input type="button" id="cancel" class="visionBtn" value="Cancel" onclick="if (!confirm('Are you sure you want to cancel any unsaved changes')) return false; reset();" style="width:80px"/> </td> </tr> </table> </a4j:form> </f:view></div> </fieldset> </ui:composition> </jsp:root>
here in the bold i am trying to reset the field in target value when the user presses reset value every other field is getting resetted except listShuttle ... plzzzz help me in this regard...
thanks in advance
cheers
Martin -
3. Re: listShuttle values are not resetting......
javamaverik Nov 19, 2008 1:40 AM (in response to javamaverik)Hi sorry i forgot to tell u that i need to reset targetValue as well as the sourceValue.....with the previous values
-
4. Re: listShuttle values are not resetting......
ilya_shaikovsky Nov 19, 2008 4:20 AM (in response to javamaverik)such client side reset not implemented in LS component. So you should use immediate a4j:commandButton and reset the values on server side.
-
5. Re: listShuttle values are not resetting......
javamaverik Nov 19, 2008 7:50 AM (in response to javamaverik)Hi,
thanks for the early reply i just wanted to know atleast how to access this targetValue object so that i will make it to some default value when user clicks reset button atleast with the help of javascript. But i am no way finding it how to achieve this.
I think you know it better than anyone as you are the one who has designed this listShuttle(great one!!!) component :). Eagerly waiting for your response..
thanks in advance......
cheers
Martin -
6. Re: listShuttle values are not resetting......
ilya_shaikovsky Nov 19, 2008 7:57 AM (in response to javamaverik)you have only source list filled by defult? Or there are both lists could be not empty?
-
7. Re: listShuttle values are not resetting......
javamaverik Nov 19, 2008 9:30 AM (in response to javamaverik)i will be setting some default value in target list(which i will get it from bean) and once the user click the reset button i will restore that bean value.
my actual problem is how i suppose to get the targetValue using javascript because i have implemented listShuttle at 4 places.
If i can get that using javascript, it will make my job easy...
something like this....
document.getElementById('custDetailsEditFrm:ext_timings')= '#{custDetailsEditMBean.newCutOffs}';
but i don't get how to achieve the targetSource cell id or value to replace with what i already have in bean..
cheers
Martin -
8. Re: listShuttle values are not resetting......
nbelaevski Nov 19, 2008 8:03 PM (in response to javamaverik)Martin,
There's no single input holding component's value . When user moves items between lists component script reorders internal inputs. These inputs can be identified easily - their name is equal to shuttle client id.
In principle, you can try to restore component to previous data by saving innerHTML property of listShuttle HTML element when the component is first rendered and then apply it on reset() however that is likely to break JavaScript object state.
I've created an RFC for this feature: https://jira.jboss.org/jira/browse/RF-4991 -
9. Re: listShuttle values are not resetting......
javamaverik Nov 20, 2008 4:15 AM (in response to javamaverik)hi once again
i have worked around and got the solution as i did what ilya has adviced now i have one more problem with this listShuttle i need to sort in ascending order whenever user moves the value from source to target or vice versa and i found there is no button to do that it will be simple if i just drag and drop in whatever position i want (which i can't because i cannot sort as i can't access any target or source value using javascript)
please help me regarding this issue..
I've created an RFC for this feature: https://jira.jboss.org/jira/browse/RF-4991
i did't understand what i need to do........there as it is not allowing to post any comments or attach some files to it......
cheers
Martin -
10. Re: listShuttle values are not resetting......
ilya_shaikovsky Nov 20, 2008 4:25 AM (in response to javamaverik)i did't understand what i need to do.......
Just vote for this feature in jira. Also you could add yourself to watchers to be updated after the issue resolved or commented.
about sorting.. This also not available on client side.
you could use onlistchanged event using a4j:support and resort the lists as you need via ajax.
B.t.w. there is an RFC in jira which tells about js API to allow client side moving to some concrete positions but it still not palnned to nearest releases.