The code below shows that I have a pageblocktable that contains a column of a ckeditor which is a long text. I want to rerender it within the same page by adding of a new row using the button Add Row. Whenever I tried to click on the Add Row button, the page always refresh and the values of the recently added rows was disappeared. Is there a way that the value of the long text will not disappear and will not refresh the page? Thanks.
<apex:column headerValue="Action">
<apex:commandLink value="Delete" style="Button" action="{!delWrapper}" reRender="wtable">
<apex:actionSupport event="onchange" rerender="theBlock" oncomplete="ReloadCkEditor();"/>
<apex:param name="toDelIdent" value="{!pw.ident}" assignTo="{!toDelIdent}"/>
</apex:commandLink>
</apex:column>
<apex:column headerValue="Company Name">
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:inputField value="{!pw.peforWrapper.Name}"/>
</apex:outputPanel>
</apex:column>
<apex:column headerValue="Job Description" id="col">
<apex:outputPanel styleClass="requiredInput" layout="block" >
<apex:outputPanel styleClass="requiredBlock" layout="block" />
<apex:outputPanel id="JDPanel">
<apex:inputtextarea id="oNextSteps1" styleClass="ckeditor" value="{!pw.peforWrapper.Job_Description__c}"/>
<script>
CKEDITOR.replace('{!$Component.oNextSteps1}',{
width: '100%',
height: 120,
removeButtons: 'Link,Unlink,Cut,Copy,Paste,Undo,Redo,Strike,Subscript,Superscript,Anchor,About'
}
);
</script>
</apex:outputPanel>
</apex:outputPanel>
</apex:column>
</apex:pageBlockTable>
<-----FRONT END SCRIPT----->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<apex:includescript value="{!URLFOR($Resource.CKEditor, 'ckeditor/adapters/jquery.js')}" />
<apex:includescript value="{!URLFOR($Resource.CKEditor, 'ckeditor/ckeditor.js')}" />
<!---- ADD ROWS ----->
public void addRows(){
for (Integer idx=0; idx<addCount; idx++){
prWrapper.add(new ProfExpWrapper(nextIdent++));
}
}
<!---- WRAPPER ----->
public class ProfExpWrapper{
public Professional_Experience__c peforWrapper {get;set;}
public Integer ident {get;set;}
public ProfExpWrapper(Integer inIdent, Professional_Experience__c professionalExperience){
ident=inIdent;
peforWrapper= professionalExperience;
}
public ProfExpWrapper(Integer inIdent){
ident=inIdent;
peforWrapper= new Professional_Experience__c();
}
}