javascript for formatting datatable