Hi,
Asking for help on my javascript. I just want to get the label of the header of data table using javascript. but no output once i debug it. can someone help me to check my code. Thanks
Hello @Jorz
I have implemented it using query selector attaching an omlfor the same
Sample - Table Header values
I hope this helpsThanksTousif Khan
Hello,is your table Mapped to an Entity?
If yes then you can easily get the col names by these tables
https://www.outsystems.com/forums/discussion/69478/display-entity-column-names-on-screen-in-dropdown/
If you want this through UI only then,Check here - https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_td_headers
I hope this will help
ThanksTousif Khan
Thanks for your response. But i'm using the data table id instead of header id. My code is working on DevTools as you can see on below screenshot. How to apply this code using outsystems approach since I'm using input parameter for table ID and output parameter for the header label.
Thanks,
Thanks, It's already working.
Hi @Jorz
Try the following code:
var table = document.getElementById($parameters.Tbl_Id);
var headerCells= table.getElementsByTagName("th");
var headerLabels = "";
for (var i = 0; i < headerCells.length; i++) {
var label = headerCells[i].innerText;
headerLabels += label + " ";
}
$parameters.Header = headerLabels;