Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

Change Summary Table Headings

You can change the "column" heading with a little javascript. Just add a text area and add this script:


js

//script parameter
const newColName = "something+ descriptive"
let i=0

function setColName(){
//set column name

// Select the node that will be observed for mutations
const colHeader= document.querySelectorAll(".sfc-summary-table .sfc-column-header");

//fisrt column is last colHeader ¯\_(ツ)_/¯  
const columnHeader = colHeader[colHeader.length-1]

//change fisrt col name
columnHeader.innerHTML = newColName

//if first col name changes, change it back
// Options for the observer (which mutations to observe)
const config = { attributes: !true, childList: true, subtree: true };

// Callback function to execute when mutations are observed
const callback = function(mutationList, observer) {
console.log(i,targetNode.innerText)
    // Use traditional 'for loops' for IE 11
//    for(const mutation of mutationList) {
// targetNode.innerText = newColName
//    }
};

// Create an observer instance linked to the callback function
const observer = new MutationObserver(callback);

// Start observing the target node
const targetNode = document.querySelectorAll(".sfc-summary-table .topLeftCornerCanvas")[0]
observer.observe(targetNode, config);

observer.disconnect();

//keep monitoring every 3 seconds in case it changes back to "column"
setTimeout(setColName,3000)
}

setColName()
 

No comments: