'Format a number into a datatable in JavaScript
Format a table in JavaScript. I have 1 table with the following data CUNIT: .056 What I want: 0.056 In my database my procedure gives me a result of 0.056. Use the DataTables | Table plugin for jQuery. What I want to do is in the image:enter image description here
var tbl_ctsunit;
function List_CTSUnit(id){
tbl_ctsunitario = $("#tbl_ctsunit").DataTable({
"ordering": false,
"bLengthChange": true,
"searching": {"regex":false},
"lengthMenu": [[10,25,50,100,-1],[10,25,50,100, "All"]],
"pageLength":10,
"destroy": true,
"async": false,
"processing": true,
"bPaginate":false,
"bFilter": false,
"bInfo":false,
"sDom":'t',
"ajax":{
"url": "../controller/datos/controller_list_ctsunit.php",
type:'POST',
data:{
id:id
}
},
"columns":[
{"data":"PRODUC"},
{"data":"T_UNIT"},
{"data":"CUNIT"},
],
"language":idioma_espanol,
select: true
});
}
<table id="tabla_ctsunitario" class="display">
<thead>
<label>Costos Unitario</label>
<tr>
<th>PROD</th>
<th style="width:100px">CUNIT</th>
</tr>
</thead>
</table>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
