Hi Leah,
Here are a couple of key extracts of the HTML and the javascript that create some placeholders with tags to display the values and links, and the JS to replace those with values from pivot table views:
HTML extract:
<a class="_summary-head px-2 mr-auto text-light rounded-top d-block text-decoration-none" href="#my-approvals-and-collaboration/">
<span class="_fa-icon align-baseline fa fa-check"></span>
My Approvals and Collaboration
</a>
<div class="_summary rounded-bottom">
<div class="row">
<div class="_column-div col-sm">
<div class="_column bg-light shadow m-2 p-2 rounded-lg">
<div class="_column-head font-weight-light mr-auto text-nowrap">APPROVE
</div>
<div class="_column-info d-sm-flex">
<a class="_link _info-div d-flex flex-sm-column text-decoration-none text-reset pr-sm-4 mr-sm-2 py-2 py-sm-0">
<div class="mr-auto _text-warning text-nowrap">
<span class="_fa-icon align-baseline fa fa-clock-o"></span>
due
</div>
<div id="not-approvecollab-approve-due-val">loading...
</div>
</a>
<a class="_link _info-div d-flex flex-sm-column text-decoration-none text-reset pr-sm-4 mr-sm-2 py-2 py-sm-0">
<div class="mr-auto text-danger text-nowrap">
<span class="_fa-icon align-baseline fa fa-exclamation-triangle"></span>
overdue
</div>
<div id="not-approvecollab-approve-overdue-val">loading...
</div>
</a>
</div>
</div>
</div>
<div class="_column-div col-sm">
<div class="_column bg-light shadow m-2 p-2 rounded-lg">
<div class="_column-head font-weight-light mr-auto text-nowrap">ENDORSE
</div>
<div class="_column-info d-sm-flex">
<a class="_link _info-div d-flex flex-sm-column text-decoration-none text-reset pr-sm-4 mr-sm-2 py-2 py-sm-0">
<div class="mr-auto _text-warning text-nowrap">
<span class="_fa-icon align-baseline fa fa-clock-o"></span>
due
</div>
<div id="not-approvecollab-endorse-due-val">loading...
</div>
</a>
<a class="_link _info-div d-flex flex-sm-column text-decoration-none text-reset pr-sm-4 mr-sm-2 py-2 py-sm-0">
<div class="mr-auto text-danger text-nowrap">
<span class="_fa-icon align-baseline fa fa-exclamation-triangle"></span>
overdue
</div>
<div id="not-approvecollab-endorse-overdue-val">loading...
</div>
</a>
</div>
</div>
</div>
<div class="_column-div col-sm">
<div class="_column bg-light shadow m-2 p-2 rounded-lg">
<div class="_column-head font-weight-light mr-auto text-nowrap">CONSULT
</div>
<div class="_column-info d-sm-flex">
<a class="_link _info-div d-flex flex-sm-column text-decoration-none text-reset pr-sm-4 mr-sm-2 py-2 py-sm-0">
<div class="mr-auto _text-warning text-nowrap">
<span class="_fa-icon align-baseline fa fa-clock-o"></span>
due
</div>
<div id="not-approvecollab-consult-due-val">loading...
</div>
</a>
<a class="_link _info-div d-flex flex-sm-column text-decoration-none text-reset pr-sm-4 mr-sm-2 py-2 py-sm-0">
<div class="mr-auto text-danger text-nowrap">
<span class="_fa-icon align-baseline fa fa-exclamation-triangle"></span>
overdue
</div>
<div id="not-approvecollab-consult-overdue-val">loading...
</div>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
Javascript:
function replaceValueOnDashboard(fromTagSelector, toTagSelector){
var val = $(fromTagSelector).text();
// if string
if(isNaN(val)){
$(toTagSelector).text(val);
return val;
}
// if number
else {
if(val > 0){
$(toTagSelector).text(val).closest(“a”).click(function() {
$(fromTagSelector).click();
});
}
else {
// even though we are hiding, let’s copy that value
$(toTagSelector).text(val).closest(“a”).click(function() {
$(fromTagSelector).click();
});
$(toTagSelector).closest(“._info-div”).removeClass(“d-flex”).hide();
}
return val;
}
}
var dashboardScenes = [“scene_1335”, /“scene_1532”, “scene_1548”,/ “scene_1736”]
for (var scene of dashboardScenes){
$(document).on(‘knack-scene-render.’ + scene, updateDashboard);
}
function updateDashboard(event, scene) {
var userView = null;
var faqView = null;
var carView = null;
var projectView = null;
var milestoneView = null;
var taskView = null;
var libraryView = null;
var performanceView = null;
var approvalsView = null;
var userPageAccessView = null;
var commView = null;
var returnsView = null;
// my own
if(scene.key == “scene_1335”){
userView = “view_4261”;
faqView = “view_3963”;
carView = “view_4206”;
projectView = “view_6490”;
milestoneView = “view_6523”;
taskView = “view_6521”;
// libraryView = “view_4208”;
libraryView = “view_5791”;
performanceView = “view_4552”;
userPageAccessView = “view_4616”;
questionsView = “view_4955”;
approvalsView = “view_5222”;
commView = “view_5432”;
returnsView = “view_6548”;
}
// APPROVE NUMBERS
// due
replaceValueOnDashboard(“#kn-report-” + approvalsView + “-1 td:eq(1)”, “#not-approvecollab-approve-due-val”);
// overdue
replaceValueOnDashboard(“#kn-report-” + approvalsView + “-1 td:eq(2)”, “#not-approvecollab-approve-overdue-val”);
// CONSULT NUMBERS
// due
replaceValueOnDashboard(“#kn-report-” + approvalsView + “-1 td:eq(4)”, “#not-approvecollab-consult-due-val”);
// overdue
replaceValueOnDashboard(“#kn-report-” + approvalsView + “-1 td:eq(5)”, “#not-approvecollab-consult-overdue-val”);
// ENDORSE NUMBERS
// due
replaceValueOnDashboard(“#kn-report-” + approvalsView + “-1 td:eq(7)”, “#not-approvecollab-endorse-due-val”);
// overdue
replaceValueOnDashboard(“#kn-report-” + approvalsView + “-1 td:eq(8)”, “#not-approvecollab-endorse-overdue-val”);