-
Sencha User
Need help on nested model in xtemplate
package ke.co.at.ehr.client.data;
import java.util.ArrayList;
import java.util.List;
import ke.co.at.ehr.client.models.DeploymentHistoryBean;
import ke.co.at.ehr.client.models.EmployeeBean;
public class EmployeeProfileData {
public static List<EmployeeBean> employees;
public static List<DeploymentHistoryBean> deploymentHistory;
static{
employees = new ArrayList<EmployeeBean>();
deploymentHistory = new ArrayList<DeploymentHistoryBean>();
EmployeeBean employee = new EmployeeBean();
employee.setId(1);
employee.setSurName("Njue");
employee.setOtherName("Humphrey M");
employee.setSex("Male");
employee.setDob(DateTimeFormat.getFormat("d/M/yy").parse("24/12/1941"));
employee.setEmployeeNo("15");
employee.setMaritalStatus("Single");
employee.setMobileNo("+254 723 815 563");
employee.setOfficeNo("020 386 0986");
employee.setTitle("Mr.");
employee.setJobTitle("Software Engineer");
DeploymentHistoryBean depHist = new DeploymentHistoryBean();
depHist.setdepartmentName("Technical");
depHist.setEmployeeId(1);
depHist.setStartDate(DateTimeFormat.getFormat("d/M/yy").parse("2/7/2008"));
depHist.setJobTitle("Sofware Engineer");
depHist.setisCurrentJob(true);
deploymentHistory.add(depHist);
employee.setDeploymentHistoryBean(deploymentHistory);
employees.add(employee);
}
}
I am using the above static modeldata to write an xtemplate which returns data from both employee model and the deploymentHistory. My template looks like shown below
public native String getProjectTeamTemplate() /*-{
return ['<div>',
'<tpl for=\"deploymentHistory\">',
'<div class="listTitlesStyle"><span style="font-family:Tahoma;font-size:13px; color:black">{jobTitle} <br>',
'<span style="font-family:Tahoma;font-size:10px;color:red">{jobDescription}</div>',
'</tpl>',
'</div>',
].join("");
}-*/;
It gives me an error that deploymentHistory is not defined. What could be the problem? Am passing employee as my model to the template.
I would Appreciate anyone who can help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules