You need to sign in to do that
Don't have an account?
AkiT
Partial page refresh leaves checkbox fields as selected
Hello folks,
Any idea why this happens:
-I have a list of wrapped items with checkbox in each row
-User can tick one and click "Activate" --> controller sets checkbox to true and only-1-logic deactivates old selection
-Partial refresh happens that rerenders the list.
Problem is that old selection still shows as selected - together with the new selection. The "activation" action works fine - after refreshing browser the values get correctly redrawn from the database. Can it somehow come from the controller that may give the existing selections plus the new selection..?
-AT
Any idea why this happens:
-I have a list of wrapped items with checkbox in each row
-User can tick one and click "Activate" --> controller sets checkbox to true and only-1-logic deactivates old selection
-Partial refresh happens that rerenders the list.
Problem is that old selection still shows as selected - together with the new selection. The "activation" action works fine - after refreshing browser the values get correctly redrawn from the database. Can it somehow come from the controller that may give the existing selections plus the new selection..?
-AT
Code:
<apex:detail relatedList="false" relatedListHover="false" /> <apex:form > <!-- HERE IS THE SELECTION LIST --> <apex:outputPanel id="verslist"> <apex:actionstatus id="verstatus" startText="(Activating...)"> <apex:facet name="stop"> <apex:pageBlock title="Versionlist" > <apex:pageBlockButtons location="top"> <apex:outputPanel id="button"> <apex:commandButton alt="Activate" value="Activate" action="{!activation}" status="verstatus" rerender="verslist"/> </apex:outputPanel> </apex:pageBlockButtons> <!-- vVer records from wrapper class --> <apex:pageBlockTable value="{!versions}" var="v" id="table"> <apex:column > <apex:inputCheckbox value="{!v.selected}" onclick="deselectOther(this)"/> <apex:actionSupport event="onclick" action="{!enable}" rerender="out,button" status="status2"/> </apex:column> <apex:column value="{!v.ver.Name}" /> <apex:column value="{!v.ver.Version_Number__c}" /> <apex:column value="{!v.ver.Description__c}" /> <apex:column value="{!v.ver.Active__c}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:facet> </apex:actionstatus> </apex:outputPanel> </apex:form> <apex:outputPanel id="out" > <apex:actionstatus id="status2" startText="Refreshing..."> <apex:facet name="stop"> <apex:outputPanel rendered="{!dpanel}"> <apex:pageBlock title="Details"> <apex:pageBlockTable value="{!products}" var="p" id="restable"> <apex:column value="{!p.Product__c}" /> <apex:column value="{!p.Quantity__c}" /> <apex:column value="{!p.Price__c}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:outputPanel> </apex:facet> </apex:actionstatus> </apex:outputPanel> <script> var selectedChkbox; function deselectOther(chkBox) { if (chkBox.checked) { if ((chkBox != selectedChkbox) && (selectedChkbox != null)) { selectedChkbox.checked = false; } selectedChkbox = chkBox; } } </script> </apex:page>
All Answers
methods. I'm also a little confused as to why you are calling the checkbox javascript. I'm not sure if this is needed....or I'm misunderstanding what it does.
Message Edited by TehNrd on 11-19-2008 02:28 PM
the {!enable} may be unnecessary, as the intend is just to rerender button row - buttons either show or hide based on disabled value - this is not in the above VF code but it should be: <apex:commandButton disabled="{!stat}".../>
controller (some part shortened):
I feel the problem is in the "version handling" part - page rerenders the old selections...
Message Edited by AT on 11-20-2008 10:56 AM
Message Edited by AT on 11-20-2008 11:10 AM