Service Portal Tabbed Catalog Widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2017 09:45 AM
Hello,
I am trying to create a widget that will show the catalogs "sc_catalogs" as tabs. Then when I click on the tabs, I need to change/switch a widget to show the catalog items for that catalog selected. The widget I am trying to render everytime I select a tab is the OOB "Catalog Content" widget but it does not seem to work. Have anyone tried something similar or can help me findout whats going on? Thanks!
My Widget so far...
Body HTML template:
<div class="panel panel-default" ng-if="data.catalogList.length > 0">
<div class="panel-body">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" ng-class='{active:$first}' ng-repeat="list in data.catalogList">
<a data-target="#{{list.title}}" role="tab" ng-class='{active:$first}' data-toggle="tab">
{{list.title}}
<!--span class="label label-as-badge label-primary" ng-if="list.count">{{list.count}}</span-->
</a>
</li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane" id="{{list.title}}" ng-class='{active:$first}' ng-repeat="list in data.catalogList">
<div style="margin-top: -1px;">
<div class="alert alert-danger" ng-if="data.invalid_table">
Table not defined '{{data.table_label}}'
</div>
<sp-widget widget="list.widget"></sp-widget>
//These are some tests
<!--widget id="custom-catalog-content" options="data.listOpt1" >TEST</widget-->
<!--widget id="custom-catalog-content" options='{"sys_id": "f2d9b0fa53e231008283a5f4a11c08b7"}'><widget-->
</div>
</div>
</div>
</div>
</div>
Server Script:
(function() {
data.f = {};
data.table = "sc_catalog";
data.catalogList = [];
var gr = new GlideRecord('sc_catalog');
gr.addQuery('active', true);
gr.query();
while(gr.next()){
var temp = {};
temp.title = gr.title.toString();
temp.sysid = gr.sys_id.toString();
data.catalogList.push(temp);
}
//if (!data.table || !data.sys_id)
//return;
if (!data.catalogList)
return;
for (var i in data.catalogList) {
var list = data.catalogList[i];
//gs.addInfoMessage("My Title:"+list.table);
var params = {
sys_id: list.sys_id,
title: list.title
};
if (options.page) {
var page = new GlideRecord('sp_page');
if (page.get(options.page))
data.page = page.getDisplayValue('id');
}else
options.page = 'sc_category';
if (!data.page) {
data.page = "form";
}
list.widget = $sp.getWidget('custom-catalog-content', params);
}
})();
Client Controller:
function($rootScope, $location) {
/* widget controller */
var c = this;
$rootScope.$on('data.table.click', function(event,obj) {
console.log(obj);
var link = {};
link.sys_id = obj.sys_id;
link.table = obj.table;
link.id = c.data.page;
$location.search(link);
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2017 09:01 AM
Nevermind this, I was able to implement it. Not dynamically which was how I wanted it but works. Created multiple copies of the catalof content widget pointing to different departments, I used "uib-tabs" to show the "sc_catalogs" and diplay widgets on each tab.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2019 12:29 PM
Hello David,
Thanks for posting. Can you provide a bit more how you used uib-tabs? I'm trying to use but so far I am not able to have it work as I am hoping.
Thanks,
Kurt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2020 05:01 PM
Awesome. Can you provide some screenshot and/or direction on how you configured it?