<table id="datatable">
<thead>
<tr>
<th>ID</th>
<th>Created By</th>
<th>Date</th>
<th>Company</th>
<th>Origin</th>
<th>Destination</th>
</tr>
</thead>
<tbody>
<cfoutput query="rsTickets"><tr>
<td>#NumberFormat(rsTickets.ID, '000000')#</td>
<td>#rsTickets.FullName#</td>
<td>#DateFormat(rsTickets.CreatedTime,'yyyy-mm-dd')# #TimeFormat(rsTickets.CreatedTime,'hh:mm tt')#</td>
<td>#rsTickets.CompanyName#</td>
<td>#rsTickets.QuoteOriginCity#, #rsTickets.QuoteOriginCountry#</td>
<td>#rsTickets.QuoteDestinationCity#, #rsTickets.QuoteDestinationCountry#</td>
</tr></cfoutput>
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function () {
$('#datatable').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"aoColumns": [
{"bSearchable": true},
{"bSearchable": true},
{"bSearchable": true},
{"bSearchable": true},
{"bSearchable": true},
{"bSearchable": true}
] } );
} );
</script>
Example Generated Code. Note this: style="width: 1089px;" on the <table><div id="datatable_wrapper" class="dataTables_wrapper"><div class="fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"><div class="dataTables_length" id="datatable_length">Show <select size="1" name="datatable_length"><option value="10">10</option><option value="25">25</option><option value="50">50</option><option value="100">100</option></select> entries</div><div class="dataTables_filter" id="datatable_filter">Search: <input type="text"></div></div><table style="width: 1089px;" id="datatable"> <thead> <tr> <th class="ui-state-default" style="width: 105px;"><span class="css_right ui-icon ui-icon-triangle-1-n"></span>Quote ID</th> <th class="ui-state-default" style="width: 132px;"><span class="css_right ui-icon ui-icon-carat-2-n-s"></span>Created By</th> <th class="ui-state-default" style="width: 239px;"><span class="css_right ui-icon ui-icon-carat-2-n-s"></span>Created Date</th> <th class="ui-state-default" style="width: 202px;"><span class="css_right ui-icon ui-icon-carat-2-n-s"></span>Company</th> <th class="ui-state-default" style="width: 118px;"><span class="css_right ui-icon ui-icon-carat-2-n-s"></span>Origin</th> <th class="ui-state-default" style="width: 137px;"><span class="css_right ui-icon ui-icon-carat-2-n-s"></span>Destination</th> </tr> </thead> <tbody> <tr class="odd"> <td class="sorting_1">000001</td> <td class="">Fred Flintstone</td> <td class="">2009-11-17 10:43 AM</td> <td class="">Test Company</td> <td class="">Vancouver, Canada</td> <td class="">Seattle, United States</td> </tr> <tr class="even"> <td class="sorting_1">000002</td> <td class="">Barney Rubble</td> <td class="">2009-11-17 11:10 AM</td> <td class="">Another Company</td> <td class="">Toronto, Canada</td> <td class="">Amsterdam, Netherlands</td> </tr></tbody> </table><div class="fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"><div class="dataTables_info" id="datatable_info">Showing 1 to 2 of 2 entries</div><div id="datatable_paginate" class="dataTables_paginate fg-buttonset fg-buttonset-multi paging_full_numbers"><span id="datatable_first" class="first ui-corner-tl ui-corner-bl fg-button ui-state-default ui-state-disabled">First</span><span id="datatable_previous" class="previous fg-button ui-state-default ui-state-disabled">Previous</span><span><span class="fg-button ui-state-default ui-state-disabled">1</span></span><span id="datatable_next" class="next fg-button ui-state-default ui-state-disabled">Next</span><span id="datatable_last" class="last ui-corner-tr ui-corner-br fg-button ui-state-default ui-state-disabled">Last</span></div></div></div>
#datatable {
width: 100% !Important;
}
$(document).ready(function() {
/* Add a click handler to the rows - this could be used as a callback */
$("#dtable tbody").click(function(event) {
$(oTable.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});
/* Init the table */
oTable = $('#dtable').dataTable();
} );
<table class="display" id="dtable">
<thead><tr><th>Label</th><th>Hostname</th><th>Description</th></tr></thead>
<tbody>
<tr><td>vpeptest1</td><td>10.3.50.11</td><td>Test 1</td></tr>
<tr><td>vpeptest2</td><td>10.3.50.12</td><td>Test 2</td></tr>
<tr><td>vpeptest3</td><td>10.3.50.13</td><td>Test 3</td></tr></tbody>
<tfoot><tr><th>Label</th><th>Hostname</th><th>Description</th></tr></tfoot></table>
table.display tfoot th {
padding: 3px;
border-top: 1px solid black;
font-weight: bold;
width: 1px;
}
It looks like you're new here. If you want to get involved, click one of these buttons!
Get useful and friendly help straight from the source.