I want to show hindi or gujarati data to the table using DataTable.js API. i have following javascript code :
$(document).ready(function(){
// On page load: datatable
var url = "<?php echo base_url();?>list?job=get_companies";
var table_companies = $('#table_companies').dataTable({
"ajax": url,
"lang": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Gujarati.json",
"language": {
"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Gujarati.json"
},
"columns": [
{ "data": "id" },
{ "data": "text", "sClass": "Text" },
{ "data": "userid" }
],
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [-1] }
],
"lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
"oLanguage": {
"oPaginate": {
"sFirst": " ",
"sPrevious": " ",
"sNext": " ",
"sLast": " ",
},
"sLengthMenu": "Records per page: _MENU_",
"sInfo": "Total of _TOTAL_ records (showing _START_ to _END_)",
"sInfoFiltered": "(filtered from _MAX_ total records)"
}
});
});
and then i was give response from php file look like (there is to three parameter to the array and the data have string of hindi or Gujarati data format thne how to set data using dataTable.js):
$data = array(
"result" => $result,
"message" => $message,
"data" => $mysql_data
);
// Convert PHP array to JSON array
$json_data = json_encode($data);
print $json_data;