JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/floatthead/2.1.1/jquery.floatThead.min.js"></script>
<div id="test">
</div>
CSS
.axdsTable{
}
.axdsTable th{
font-weight:normal;
}
.axdsTable th.ele_align_text, .axdsTable td.ele_align_text{
text-align:left;
}
.axdsTable th.ele_align_number, .axdsTable td.ele_align_number{
text-align:right;
}
table.floatThead-table {
border-top: none;
border-bottom: none;
background-color: #fff;
}
JavaScript
/*
options
infoModalId <- str, optional, default:"infoModalId"
noDataMessage <- str, optional, e.g:"no data", default:""
tableClass <- str, optional, e.g:"table table-bordered", default:""
colOrder <- objArray, defines the col order and col ids. [{"id","text"}], default: no columns..
colSetting <- objArray, optional, defines col formatting, [{"targetColId"}], default: plain table formatting
targetColId <- str, links the settings to the col
format <- str, optional, or pick from ["text", "number", currency", "href", "perecentageDTP", "perecentage"]
preText <- str, optional, Adds text before the value, eg: "£"
postText <- str, optional, Adds text after the value, eg: "%"
toFixed <- int, optional, rounds the number to the set decimal places.
style <- objArray, optional [{"class"}]
class <- str, optional, class applied to the column (can be defined in css).
*/
var options = {
infoModalId: "infoModalId",
noDataMessage: "no data",
tableClass: "table table-bordered table-striped table-sm table-sticky-header",
colOrder: [{
"id": "col3",
"text": "Text"
}, {
"id": "col4",
"text": "Links"
},{
"id": "col1",
"text": "Num #"
}, {
"id": "col2",
"text": "Percent %"
}, {
"id": "col5",
"text": "Amount"
}],
colSettings: [{
"targetColId": "col1",
"style": {
"class": "ele_align_number"
}
}, {
"targetColId": "col2",
"format": "perecentageDTP",
"postText": "%",
"toFixed": 0,
"style": {
"class": "ele_align_number"
}
}, {
"targetColId": "col3",
"style": {
"class": "ele_align_text"
}
}, {
"targetColId": "col4",
"format": "href",
"style": {
"class": "ele_align_text"
}
}, {
"targetColId": "col5",
"format": "currency",
"preText": "£",
"toFixed": 0,
"style": {
"class": "ele_align_number"
}
}]
}
var rowData = [{"col1":{"value":11,"title":"this is...