Adding static values in a column in datatable js
Adding static values in a column in datatable js
NagarajanE
Posts: 6Questions: 4Answers: 0
Hi
I have a scenario. i used PNP js and populated 8 column from a sharepoint list. I have binded these columns in to datatable. User wants one more column to be added and that column should contain with static value. That value we are not querying form Sharepoint list.
"aoColumns": [{"data": "ID",
"render": function(mData, type, row, meta){
return meta.row+meta.settings._iDisplayStart+1;
}
},
{ "mData":"PRid" },
{ "mData": "MonitorName.Title" },
**{Form Name} - Static value to be added here**
{ "mData": "BU" },
{ "mData": "Brand" },
{ "mData": "MonitoringDt" },
{ "mData": "Created" },
{ "data":"Created",
"render": function(data){
var date= new Date(data);
var month=date.getMonth()+1;
return (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear();
}
Please explain me how to add the value
This discussion has been closed.
Answers
Hi @NagarajanE ,
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
You can try either
--option columns.defaultContent
orcolumns.render
to render the data. If using render you may need to setcolumns.data
to either null or""
.Kevin