Hi,
When I using an external translation file http://datatables.net/plug-ins/i18n (the french translation case)
[code]
$('#tableTicketsProcheSla').dataTable({
"oLanguage": {
"sUrl":"js/Frameworks/jquery/internationalisation/datatable_french.txt"
}, ... });
[/code]
I obtain the following message :
[quote]TypeError : str is undefined[/quote]
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 [quote]oLang.sZeroRecords[/quote] at line 1499.
I solve the problem by added the following code
[code]
else if ( sZero === undefined )
{
sZero = "";
}
[/code]
at line 1509.
An other solution is to include the content of the translation directly in the js file I wrote like this :
[code]
$('#tableTicketsProcheSla').dataTable({
"oLanguage": {
...the translation copy...
}, ... });
[/code]
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 :
[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 );
}
[/code]
Thanks for your help,
Regards,
Mathieu
When I using an external translation file http://datatables.net/plug-ins/i18n (the french translation case)
[code]
$('#tableTicketsProcheSla').dataTable({
"oLanguage": {
"sUrl":"js/Frameworks/jquery/internationalisation/datatable_french.txt"
}, ... });
[/code]
I obtain the following message :
[quote]TypeError : str is undefined[/quote]
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 [quote]oLang.sZeroRecords[/quote] at line 1499.
I solve the problem by added the following code
[code]
else if ( sZero === undefined )
{
sZero = "";
}
[/code]
at line 1509.
An other solution is to include the content of the translation directly in the js file I wrote like this :
[code]
$('#tableTicketsProcheSla').dataTable({
"oLanguage": {
...the translation copy...
}, ... });
[/code]
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 :
[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 );
}
[/code]
Thanks for your help,
Regards,
Mathieu