function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
The KnightThe Knight 

Values are getting reinitialised

I am using yahoo UI modal dialog. In that I am displaying the datatable. On each row I have a command link. on click of the command link I am displaying the record details on the parent screen. Now the problenm is when I click on the command link the list in the data table is getting initialized to null value. Why this is happening. I want to use the existing list. But this list is getting lost when I am hiding the div.

 

Any help would be appreciated

Joseph

paul-lmipaul-lmi
it'd be helpful if you posted the VF page code.  it sounds like you're rerendering the table though.
The KnightThe Knight

Here is the code.   

                    

<apex:page sidebar="true" controller="mnt_patientSlideBarController">
<apex:stylesheet value="{!URLFOR($Resource.StyleSheet,'Styles.css')}"/>
<apex:styleSheet value="http://yui.yahooapis.com/2.6.0/build/assets/skins/sam/container.css" />
<apex:includeScript value="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"/>
<apex:includeScript value="http://yui.yahooapis.com/2.6.0/build/container/container-min.js" />
<apex:includeScript value="http://yui.yahooapis.com/2.6.0/build/animation/animation-min.js" />
<script>

YAHOO.namespace("force.com");

YAHOO.force.com.showMe = function() {

document.getElementById("myPanel").style.display = "block";
YAHOO.force.com.myDialog.show();

}

YAHOO.force.com.hideMe = function() {
YAHOO.force.com.myDialog.hide();


}

YAHOO.force.com.init = function() {
document.body.className = document.body.className + " yui-skin-sam";

YAHOO.force.com.myDialog = new YAHOO.widget.Panel(
"myPanel", {
width : 1020,

visible : false,

draggable : true,

close : false,

modal : true,

fixedCenter : true,

zindex : 40,

height : 30,

effect : {
effect:YAHOO.widget.ContainerEffect.FADE,
duration:0.35
}
}
);

// Render the dialog to the document.body level of the DOM
YAHOO.force.com.myDialog.render(document.body);
}

// Add the init method to the window.load event
YAHOO.util.Event.addListener(window, "load", YAHOO.force.com.init);
</script>
<!-- This is the content of the modal dialog -->
<div id="myPanel" style="display: none" >
<div class="hd">
<apex:outputText value="Patients List" />
</div>
<div class="bd" >

<apex:form id="modaldialog" >
<apex:outputPanel id="outputList" >
<apex:dataTable value="{!patientInfo}" var="patinfo" styleClass="tableClass" rowClasses="odd,even" border="1px" width="1000px" id="datatable">
<apex:column headervalue="First Name" width="80px">
<apex:actionRegion id="patientRecord">
<apex:commandlink onclick="YAHOO.force.com.hideMe();" action="{!patientDetails}" rerender="theGrid,The panel1,dialogScript">
{!patinfo.person.first_Name__c}
<apex:param name="sfdc.tabName" value="!$CurrentPage.parameters.sfdc.tabName}"/>
<apex:param name="personId" value="{!patinfo.person.Id}"/>
<apex:param name="patientId" value="{!patinfo.patientId}"/>
</apex:commandLink>
<apex:outputPanel rendered="{!hideFlag}" id="dialogScript">
<script>
YAHOO.force.com.hideMe();
</script>
</apex:outputPanel>
</apex:actionRegion>
</apex:column>
<apex:column headervalue="Middle Name" value="{!patinfo.person.middle_Name__c}" width="80px"/>
<apex:column headervalue="Last Name" value="{!patinfo.person.last_Name__c}" width="80px"/>
<apex:column headerValue="Address" value="{!patinfo.person.Address__c}" width="150px"/>
<apex:column headerValue="City" value="{!patinfo.person.City__c}" width="80px"/>
<apex:column headerValue="State" value="{!patinfo.person.State__r.StateLong__c}" width="80px"/>
<apex:column headerValue="Country" value="{!patinfo.person.Country__r.FormalName__c}" width="80px"/>
<apex:column headerValue="ZIP" value="{!patinfo.person.zip__c}" width="80px"/>
<apex:column headerValue="Email" value="{!patinfo.person.PrimaryEmail__c}" width="200px"/>
<apex:column headervalue="Social Security Number" value="{!patinfo.person.SSN__c}" width="80px"/>
<apex:column headerValue="DOB" value="{!patinfo.person.birthDate__c}" width="80px"/>
<apex:column headerValue="Phone" value="{!patinfo.person.homePhone__c}" width="80px"/>
</apex:dataTable>
</apex:outputPanel>
<div style="text-align: centre;" >
<table width="100%">
<tr align="center">
<td align="center">
<apex:commandButton value="Cancel" oncomplete="YAHOO.force.com.hideMe();" rerender="theTabPanel1" />
</td>
</tr>
</table>
</div>
</apex:form>
</div>
<div class="ft" style="font-size: 10px;">
<apex:outputPanel layout="block">
<b> Please click on the Patient First Name to select </b>
</apex:outputPanel>
</div>
</div>
<apex:form id="pms_default" >
<table border="0" width="100%">
<tr> <td valign="top" height="100%" width="20%">
<c:mnt_patientSlidebar />
</td>
</tr>
</table>
</apex:form>
</apex:page>

 Component: removed irrevelant code

   

  

<apex:component controller="mnt_patientSlideBarController">
<style type="text/css">

.defaultFont{
font-family: Calibri;
font-size:12px;
}
</style>



<apex:panelGrid columns="1" id="theGrid" width="100%">

<apex:panelBar headerClass="SlidebarHeader" contentClass="WhiiteBackgroundStyle" styleClass="SlidebarStyle">
<apex:panelBarItem label="Add / Search" >
<apex:actionRegion >
<table>
<tr>
<td> <apex:outputPanel id="SearchMessage">
<font color="red"><apex:messages styleClass="error" /> </font>
</apex:outputPanel>
<apex:inputText id="search" value="{!searchText}" size="10">

</apex:inputText>
</td>
<td>
<!-- outputList is Id of outputpanel in main page -->
<apex:commandButton value="Go" action="{!search}" rerender="outputList, dialogScript,SearchMessage,statusPanel" status="status" id="theButton" styleClass="BtnStyle"/>
<apex:outputPanel id="statusPanel">
<apex:actionstatus id="status" startText="Searching...">
</apex:actionstatus>
</apex:outputPanel>
<apex:outputPanel rendered="{!NOT(ISNULL(searchText))}" id="dialogScript">
<script>
YAHOO.force.com.showMe();
</script>
</apex:outputPanel>
</td>
</tr>
<tr>
<td>
<apex:commandButton value="Add New Patient" action="{!addNewPatient}" rerender="theGrid,demographicsoutputpanel,theTabPanel1" id="theButton1" styleClass="BtnStyle"/>
</td>
</tr>
</table>
</apex:actionRegion>
</apex:panelBarItem>
</apex:panelBar>

<apex:panelBar headerClass="SlidebarHeader" contentClass="WhiiteBackgroundStyle" styleClass="SlidebarStyle">
<!-- Start of Patient Info panel Bar Item -->
<apex:panelBarItem label="Info">
<apex:outputPanel id="resultpanel">
<apex:image id="patient_image" url="{!$Resource.Person_Photo}" height="100" width="150"/> <br/>
<b><apex:outputText value="{!person.first_Name__c} " id="personFname" styleClass="defaultFont"/>
<apex:outputText value="{!person.last_Name__c} " id="personLname" styleClass="defaultFont"/></b><br/>
<apex:outputText value="Age: " id="ageLbl" styleClass="defaultFont"/>
<apex:outputText value="{!age}" id="age" styleClass="defaultFont"/><br/>
<b><apex:outputText value="Best Phone:" id="bestphoneLbl" styleClass="defaultFont"/></b>
<b><apex:outputText value="{!bestPhone}" id="bestphone" styleClass="defaultFont"/></b><br/>
<apex:outputText value="Work: " id="workphoneLbl" styleClass="defaultFont"/>
<apex:outputText value="{!person.workPhone__c}" id="workphone" styleClass="defaultFont"/><br/>
<apex:outputText value="Email: " id="emailLbl" styleClass="defaultFont"/>
<apex:outputText value="{!person.PrimaryEmail__c}" id="email" styleClass="defaultFont"/><br/>
<apex:outputText value="Referral: " id="referralLbl" styleClass="defaultFont"/>
<apex:outputText value="{!referral}" id="referral" styleClass="defaultFont"/><br/>
</apex:outputPanel>
</apex:panelBarItem>
<!-- End of Patient Info Panel Bar Item -->
</apex:panelBar>

</apex:panelGrid>
</apex:component>

 

  Controller:

 

  

public class mnt_patientSlideBarController {

String searchText='';

public String getSearchText(){
return searchText;
}
public void setSearchText(String sText){
searchText = sText;
}

List<Person__c> per = new List<Person__c>();
public void setPer(List<Person__c> persons){
per = persons;

}
public List<Person__c> getPer(){
return per;
}
public PageReference patientDetails(){
String pid =ApexPages.currentPage().getParameters().get('personId');
String patientId = ApexPages.currentPage().getParameters().get('patientId');
/* here i am getting null value */

List<PatientInfo> patientInfo = getPatientInfo();// returning null value
return null;
}

public PageReference search(){

List<Person__c> personList = new List<Person__c>();
List<PatientInfo> pInfoList = new List<PatientInfo>();
if(searchText!=''&& searchText!=null&&searchText.length()>4){

for(Person__c p: [select Id, first_Name__c,(Select pt.Id From Patient4__r pt), last_Name__c, middle_Name__c,State__r.StateLong__c, Country__r.FormalName__c,Address__c,zip__c,homePhone__c,workPhone__c, cellPhone__c,PrimaryEmail__c,ssn__c,birthDate__c,city__c from Person__c where (first_name__c LIKE:searchText+'%' OR last_Name__c LIKE:searchText+'%' OR State__r.StateLong__c LIKE :searchText+'%' OR Country__r.FormalName__c LIKE:searchText+'%' OR zip__c =:searchText+'%' OR homePhone__c =:searchText+'%'OR workPhone__c =:searchText+'%' OR cellPhone__c =:searchText+'%' OR PrimaryEmail__c =:searchText+'%' OR ssn__c LIKE:searchText+'%' OR city__c LIKE:searchText+'%') and Deleted__c=false]){
for(Patient__c patient: p.Patient4__r){
System.debug('Inside search action for loop');
if(patient.Id!=null){
System.debug('Inside search action if condition');
PatientInfo pinfo = new PatientInfo(p,String.valueOf(patient.Id));
pInfoList.add(pinfo);
personList.add(p);

}
}
}
this.setPatientInfo(pInfoList);
this.setPer(personList);

}
else {
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please Enter atleast four Characters'));
setSearchText(null);
return null;

}
return null;

}


Person__c person = new Person__c();
public void setPerson(Person__c p){
person = p;

}
public Person__c getPerson(){
return person ;
}
Patient__c patient = new Patient__c();
public void setPatient(Patient__c pt){
patient = pt;
}
public Patient__c getPatient(){
return patient;
}
Boolean hideFlag = false;
public void setHideFlag(boolean flag){
hideFlag = flag;
}
public boolean getHideFlag(){
return hideFlag;
}
String firstName='';
public void setFirstName(String fname){
firstName = fname;
}
public String getFirstName(){
return firstName;
}

String referral ='';
public void setReferral(String referralName){
this.referral = referralName;
}
public String getReferral(){
return referral ;
}

String bestPhone='';
public void setBestPhone(String bphone){
this.bestPhone = bphone;
}
public String getBestPhone(){
return bestPhone;
}
String age='';
public void setAge(String age){
this.age= age;
}
public String getAge(){
return age;
}


/*
Class to fetch Patient Information.
*/

public class PatientInfo{
public Person__c person {get;set;}
public String patientId {get;set;}

public PatientInfo(Person__c p, String pId ){
person = p;
patientId = pId;
}
}

List<PatientInfo> patientInfo = new List<PatientInfo>();
public void setPatientInfo(List<PatientInfo> pInfo){
this.patientInfo = pinfo;
}
public List<PatientInfo> getPatientInfo(){
return this.patientInfo;
}

}


Regards

Joseph