+ Start a Discussion
prady-cmprady-cm 

Setting a selectoption value on pageblockTable rerender

I have an PageBlockTable which has a wrapper class as its value.

 

Every time a command button is clicked to add a product, a new row is added to the wrapper class and the PageblockTable is rerendered to display the new row.

 

All these work but when the rerender happens the selectedValue in the selectList is reset to the first item on the selectList.

How can i have the selectList to maintain state?

 

 <apex:commandButton action="{!addNewProduct}" value="Add New Product" rerender="pbtExistingInstItems,PBCopyProdToInstItems"/>
    <apex:selectList id="slprodname" value="{!itw.installedItem.Product__c}" size="1" rendered="{!itw.isManuallyCreated ==  true}" >
                <apex:selectOptions value="{!prodList}"/>
                <apex:actionSupport event="onchange" action="{!updateDefaultProductValues}"  rerender="colInstallationName">
                </apex:actionSupport>
    </apex:selectList>

 

Rahul SharmaRahul Sharma

prady-cm, I don't think the problem is with use of rerender. Seems issue in your addNewProduct function.