The detail page defines an onload function that executes as soon as the page is loaded:
<body onload="onloadHandler()"...> |
The onloadHandler() function accesses the specific data for the customer row that the user tapped and binds it to the detail page template:
function onloadHandler() {
// Retrieve dbname and CustomerID.
var dbname = avantgo.preferences.getStringValueForKey("ListPage_dbname");
var id = avantgo.preferences.
getStringValueForKey("detailPage_"+dbname+"Id");
dbset = dbMgr.open(dbname, r");
if(dbset == null) {
alert("Could not open the '" + dbname + "' database.");
return;
} |
// Locate the customer record that matches CustomerID.
var search = dbset.createSearch("CustomerID ==" + id);
dbset.setFilter(search);
dbset.moveFirst(); |
// Bind customer data to detail page template.
document.getElementById("customer_name").firstChild.data =
dbset.ContactName;
document.getElementById("customer_title").firstChild.data =
dbset.ContactTitle;
document.getElementById("customer_company").firstChild.data =
dbset.CompanyName;
document.getElementById("customer_address").firstChild.data =
dbset.AddressLine1;
document.getElementById("customer_city").firstChild.data =
dbset.City;
document.getElementById("customer_zip").firstChild.data =
dbset.PostalCode;
document.getElementById("customer_country").firstChild.data =
dbset.Country;
document.getElementById("customer_phone").firstChild.data =
dbset.Phone;
document.getElementById("customer_fax").firstChild.data =
dbset.Fax;
} |
| Send feedback about this page using email. | Copyright © 2008, iAnywhere Solutions, Inc. |