dynamically getting page titles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2017 10:58 AM
Hi Experts,
In the code for KB Category Page widget, there's a line of code that gets the display name for the chosen knowledge page:
data.kb_knowledge_page = $sp.getDisplayValue("kb_knowledge_page") || "kb_view";
How would I write the code to get the title (NOT id) of the page? I've tried dot-walking and using a getRefRecord, but they don't work for me.
data.page_name = $sp.getDisplayValue('kb_knowledge_page.title');
var ref = $sp.kb_knowledge_page.getRefRecord();
data.page_name = ref.getDisplayValue('title');
Is this possible? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2017 10:02 AM
I'd like to know this, too
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2018 12:05 PM
Did you solve your issue? In a case that someone would need a solution;
1 solution) in your widget client script you can use $scope.page.title
2 solution) in your widget Link Function
function(scope, element, attrs, ctrl){
if (!scope.data)
return;
var yourNewTitile = 'new title';
if(scope.data.table == '[table name]'){// your condition
document.title = yourNewTitile+' - '+scope.portal.title; // changes tab
scope.page.title = yourNewTitile; // changes page titles
}
}