How to get default content using the data() function
How to get default content using the data() function
sj00325941
Posts: 1Questions: 1Answers: 0
This is how I'm initializing my DataTables
clustTbl = $('#dt').DataTable( {
"ajax": {
"url": "getClusters.do",
"type": "POST"
},
"autoWidth": false,
"defaultContent": "NA",
"columns": [
{
data: null,
defaultContent: '<input class="row" type="checkbox" /><i id="colFilter" class="fa fa-pencil-square-o" onclick="singleEdit(this)" title="Edit This Cluster"></i>',
orderable: false
},
{
data: "clusterName",
defaultContent: "<font color='red'>null</font>",
width: "10%"
},
{
data: "clusterNameLastValue",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "clustPlanner",
defaultContent: "<font color='red'>null</font>"
},
{
data: "clustPlannerLastValue",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "clustPlannerContactId",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "clustBackPlanner",
defaultContent: "<font color='red'>null</font>"
},
{
data: "clustBackPlannerLastValue",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "clustBackPlannerContactId",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "clusterOpen",
defaultContent: "<font color='red'>null</font>"
},
{
data: "clusterOpenLastValue",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "hypervisor",
defaultContent: "<font color='red'>null</font>"
},
{
data: "hypervisorLastValue",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "orchestrator",
defaultContent: "<font color='red'>null</font>"
},
{
data: "orchestratorLastValue",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "environment",
defaultContent: "<font color='red'>null</font>"
},
{
data: "environmentLastValue",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "appOwnerType",
defaultContent: "<font color='red'>null</font>"
},
{
data: "appOwnerTypeLastValue",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "timezoneOffset",
defaultContent: "<font color='red'>null</font>"
},
{
data: "timezoneOffsetLastValue",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "alias",
defaultContent: "<font color='red'>null</font>"
},
{
data: "aliasLastValue",
defaultContent: "",
"visible": false,
"searchable": false,
},
{
data: "clusterNotes",
defaultContent: "<font color='red'>null</font>"
},
{
data: "clusterNotesLastValue",
defaultContent: "",
"visible": false,
"searchable": false,
},
],
"rowCallback": function( row, data, index ) {
$(row).children("td:first-child").each(function(){
$(this).find('input').attr('id', data.vmwClustDimId);
});
//console.log(($(row).children("td:first-child")).$("input[type='checkbox'"));
},
"drawCallback": function( settings ) {
$('#load-div').css('display', 'none');
$('#content-wrapper').show();
},
order: [ 1, 'asc' ],
tableTools: {
sRowSelect: "os",
sRowSelector: 'td:first-child',
}
});
As you can see, I have a default content for my first column which is a checkbox. I want to get the state of all the checkboxes at run-time for all the rows and then get the row's data for which this checkbox is selected. How do I do that ?
I tried using clustTbl.data()
and iterating over it, but the data retrieved doesn't contain my first column.
This discussion has been closed.