Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1816

Mistake with internationalisation

$
0
0
Hi,

When I using an external translation file http://datatables.net/plug-ins/i18n (the french translation case)
$('#tableTicketsProcheSla').dataTable({
     "oLanguage": {
       "sUrl":"js/Frameworks/jquery/internationalisation/datatable_french.txt"
       }, ... });
I obtain the following message :
TypeError : str is undefined

at jquery.datatable.js at line 2567.
When I search the line in case of that mistake, I found the sOut as undefined at line 1509 of the datatable file, the variable sZero is initialized
oLang.sZeroRecords
at line 1499.
I solve the problem by added the following code
else if ( sZero === undefined )
{
           sZero = "";
}
at line 1509.

An other solution is to include the content of the translation directly in the js file I wrote like this :
$('#tableTicketsProcheSla').dataTable({
     "oLanguage": {
       ...the translation copy...
}, ... });

This error appear when I apply a filter on column (the last line).

Maybe I don't use datatable correctly, if you have any idea why I obtain the undefined value whitout modification of datatable framework.

My code :
function sortTableSla( userName )
{
	var tableProcheSla = $('#tableTicketsProcheSla').dataTable({
		"oLanguage": {
			  "sUrl":"js/Frameworks/jquery/internationalisation/datatable_french.txt"
			},
		"aoColumnDefs": [
							{ "sWidth": "50px" , "aTargets": [ 0 ] },
							{ "sWidth": "350px", "aTargets": [ 1 ] },
							{ "sWidth": "100px", "aTargets": [ 3 ] },
							{ "sWidth": "100px", "aTargets": [ 4 ] },
							{ "sWidth": "100px", "aTargets": [ 5 ] },
							{ "sWidth": "170px", "aTargets": [ 6 ] }
						],
						"bStateSave": true,
						"iDisplayLength": 10,
						"bLengthChange": false,
						"bAutoWidth": false,
						"bDestroy": true,
						"aaSorting":[ [4,'asc'] ]
					}).columnFilter({
						sPlaceHolder: "head:after",
						aoColumns: [ 
							{ type: "text" },
							{ type: "text" },
							{ type: "select" },
							{ type: "date-range" },
							{ type: "date-range" },
							{ type: "select" },
							{ type: "select" }
						]
	
					});
	var found = false;
	$('#tableTicketsProcheSla').find("select").each(function( index ){
		try{			
			$(this).find("option").filter(function(){
				if( $(this).text() == userName ) found = true;
				return $(this).text() == userName;
			}).prop('selected', true);
		}catch (e) {
			console.log(e);
		}
	});
//	
	if( !found )
	{
		var divParent = $("#tableTicketsProcheSla").parent();
		var newDiv = createDivForDataTable("tableTicketsProcheSla", userName, 2 );
		divParent.append( newDiv );
	}
	tableProcheSla.fnFilter( userName, 2 );	
}

Thanks for your help,
Regards,
Mathieu

Viewing all articles
Browse latest Browse all 1816

Trending Articles