Here is a small example of how to read the pagemetaData parameters from a page using javascript:
var nm = com.ibm.mashups.enabler.navigation.Factory.getNavigationModel();
var selectedNode = nm.find(ibmCfg.portalConfig.currentPageOID).start();
// fetch the currentpage metadata only
selectedNode.getmetaData("metdataparametername");
// fetch all aggregated metadata values
metadatavalue = aggregatedPageMetadata["metadataparameter"];
Here is an example of how to store new metadata values:
var nm = com.ibm.mashups.enabler.navigation.Factory.getNavigationModel();
var selectedNode = nm.find(ibmCfg.portalConfig.currentPageOID).start();
selectedNode.setMetaData("cds.css." + type ,url);
nm.commit().start(); // Sync save.
var asyncSave = nm.commit();
asyncSave.setFinishedCallback(commited);
asyncSave.setOperationCallback(commitoper);
asyncSave.start();
// finished callback function
function commited(result, status) {
// handle overall status
if (status == 200 status == 201) {
alert("Successfully committed navigation model.");
} else {
alert("Failed to commit navigation model;
HTTP status code '" + status + "'.");
}
}
// operation callback function
function commitoper(result, operation, status) {
if (operation == asyncSave.OPERATION_SAVE){
}else if (operation == asyncSave.OPERATION_MODIFY){
}else if (operation == asyncSave.OPERATION_DELETE){
}
}
asyncSave.setOperationCallback(commitoper);
asyncSave.start();
// finished callback function
function commited(result, status) {
// handle overall status
if (status == 200 status == 201) {
alert("Successfully committed navigation model.");
} else {
alert("Failed to commit navigation model;
HTTP status code '" + status + "'.");
}
}
// operation callback function
function commitoper(result, operation, status) {
if (operation == asyncSave.OPERATION_SAVE){
}else if (operation == asyncSave.OPERATION_MODIFY){
}else if (operation == asyncSave.OPERATION_DELETE){
}