Hi - Here's my code. There's a table being rendered with a file size showing, 1mb, 24k, and so on. Does this code look right to do this ? I've attached the errror. It's in the columns definition line. Getting an unknown parameter. Any help would be appreciated. Thank you!
if (!orderAttachmentsDTO[orderItemID]) {
orderAttachmentsDTO[orderItemID] = $attachmentsTable.DataTable({
destroy:true,
data:itemAttachments,
columns:[orderAttachmentsMap["type": "file-size", "targets": 2]],
autoWidth:false,
order: [[ 0, 'asc' ]],
paging:false,
dom:'ft',
searching: false,
language: {
emptyTable: ax.L(911),
zeroRecords: ax.L(911)
}
});
Here's the data coming back in the JSON response.
And the error.
Below is the code from the file-size.js
jQuery.fn.dataTable.ext.type.order['file-size-pre'] = function ( data ) {
var units = data.replace( /[\d\.\s]/g, '' ).toLowerCase();
var multiplier = 1;
if ( units === 'kb' ) {
multiplier = 1000;
}
else if ( units === 'mb' ) {
multiplier = 1000000;
}
else if ( units === 'gb' ) {
multiplier = 1000000000;
}
else if ( units === 'tb' ) {
multiplier = 1000000000000;
}
else if ( units === 'pb' ) {
multiplier = 1000000000000000;
}
return parseFloat( data ) * multiplier;
};