fnSetFilteringDelay does not work for me when i use "oLanguage" to initialize the datatables
fnSetFilteringDelay does not work for me when i use "oLanguage" to initialize the datatables
DataTables is the best plug-ins that I've seen, it is very useful for me, thanks a lot for authors
But I got a problem with fnSetFilteringDelay function yesterday, I think maybe it is a bug
If I don't use "oLanguage" to initialize the datatables, everything is ok, but when I use "oLanguage", everything is ok too but fnSetFilteringDelay dose not work.
I debug the code, find the variable "anControl" maybe is wrong, the reason maybe is oLanguage, I guess
please check that variable, it is different between use "oLanguage" to initialize the datatables and not.
The code which has problem is here:
[code]
otable_table = $("#htable_table").dataTable(
{
"oLanguage": {"sUrl": "../data/zh_ZH.txt"},//if remove this line, fnSetFilteringDelay works
"bJQueryUI": true,
"bStateSave": false,
"bPaginate": true,
"bAutoWidth": false,
"bProcessing": true,
"bServerSide": true,
"sPaginationType": "full_numbers",
"sAjaxSource": "test.ashx",
"aoColumnDefs":[
{"bVisible": false, "sName":"PK_DICT_TABLE", "aTargets":[0]},
{"bVisible": true, "sName":"DICT_TABLE_CODE", "aTargets":[1]},
{"bVisible": true, "sName":"DICT_TABLE_NAME", "aTargets":[2]},
{"bVisible": true, "sName":"DICT_TABLE_CLASS_NAME", "aTargets":[3]},
{"bVisible": true, "sName":"DICT_TABLE_MEMO", "aTargets":[4]},
{"bVisible": true, "sName":"DICT_TABLE_CATEGORY", "aTargets":[5]}
]
});
otable_table.fnSetFilteringDelay(500);}
[/code]
"zh_ZH.txt" is a language file that i use.
When I remove the line ""oLanguage": {"sUrl": "../data/zh_ZH.txt"},", everythink is ok.
"oLanguage" is a very useful option for me, so, thanks again for check this bug.
If the code is wrong, please reply me, thanks again
But I got a problem with fnSetFilteringDelay function yesterday, I think maybe it is a bug
If I don't use "oLanguage" to initialize the datatables, everything is ok, but when I use "oLanguage", everything is ok too but fnSetFilteringDelay dose not work.
I debug the code, find the variable "anControl" maybe is wrong, the reason maybe is oLanguage, I guess
please check that variable, it is different between use "oLanguage" to initialize the datatables and not.
The code which has problem is here:
[code]
otable_table = $("#htable_table").dataTable(
{
"oLanguage": {"sUrl": "../data/zh_ZH.txt"},//if remove this line, fnSetFilteringDelay works
"bJQueryUI": true,
"bStateSave": false,
"bPaginate": true,
"bAutoWidth": false,
"bProcessing": true,
"bServerSide": true,
"sPaginationType": "full_numbers",
"sAjaxSource": "test.ashx",
"aoColumnDefs":[
{"bVisible": false, "sName":"PK_DICT_TABLE", "aTargets":[0]},
{"bVisible": true, "sName":"DICT_TABLE_CODE", "aTargets":[1]},
{"bVisible": true, "sName":"DICT_TABLE_NAME", "aTargets":[2]},
{"bVisible": true, "sName":"DICT_TABLE_CLASS_NAME", "aTargets":[3]},
{"bVisible": true, "sName":"DICT_TABLE_MEMO", "aTargets":[4]},
{"bVisible": true, "sName":"DICT_TABLE_CATEGORY", "aTargets":[5]}
]
});
otable_table.fnSetFilteringDelay(500);}
[/code]
"zh_ZH.txt" is a language file that i use.
When I remove the line ""oLanguage": {"sUrl": "../data/zh_ZH.txt"},", everythink is ok.
"oLanguage" is a very useful option for me, so, thanks again for check this bug.
If the code is wrong, please reply me, thanks again
This discussion has been closed.
Replies
So fnInitComplete is the way forward I think: http://datatables.net/usage/callbacks#fnInitComplete
Allan
use fnInitComplete callback, it works fine
it seems not a bug, sorry~
big thanks
[code]
otable_user = $("#htable_user").dataTable(
{
"oLanguage": {"sUrl": "../data/zh_ZH.txt"},
"bJQueryUI": true,
"bStateSave": false,
"bPaginate": true,
"bAutoWidth": false,
"bProcessing": true,
"bServerSide": true,
"sPaginationType": "full_numbers",
"fnInitComplete": function(){this.fnSetFilteringDelay(500);},//this is callback function
"sAjaxSource": ajaxsource,
"aaSorting": [[3,'desc']],
"aoColumnDefs":[
{"bVisible": false, "sName":"PK_USER", "aTargets":[0]},
{"bVisible": true, "sName":"USER_PASSWORD", "aTargets":[1]},
{"bVisible": false, "sName":"DR", "aTargets":[2]},
{"bVisible": false, "sName":"TS", "aTargets":[3]},
{"bVisible": true, "sName":"USER_CODE", "aTargets":[4]},
{"bVisible": true, "sName":"USER_EMAIL", "aTargets":[5]},
{"bVisible": true, "sName":"USER_ALLOWLOGIN", "aTargets":[6]},
{"bVisible": true, "sName":"USER_STARTDATE", "aTargets":[7]},
{"bVisible": true, "sName":"USER_ENDDATE", "aTargets":[8]}
]
});
[/code]
Allan
Allan
here is my code (where /scripts/dataTables.addons.js contains the fnSetFilteringDelay() code from http://www.datatables.net/plug-ins/api )
[code]
...
...
<!--
var oTable;
$(document).ready(function() {
....
var controller_name = "zona";
oTable = $('#visualizzazione').dataTable(
{
"oLanguage": {
"sUrl": "/lang/dataTables-it_IT.txt"
},
//"bStateSave": true,
"aoColumns": [
{ "sName": "nome", "sWidth": "80%"},
{ "sName": "id", "sWidth": "20%", "bSortable": false, "bSearchable" :false } ],
"aLengthMenu": [[5, 10, 25, 50, 100, -1], [5, 10, 25, 50, 100, "Tutti"]],
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/"+controller_name+"/ajax/",
"fnDrawCallback": function ( oSettings ) {
/* Need to redo the counters if filtered or sorted */
for ( var i=0, iLen=oSettings.aiDisplay.length ; i
Allan
i just tested that even if i don't use a language file it still won't work
is this order correct ?
i mean, first dataTables, then the fnSetFilteringDelay script ?
I'd suggest adding in a couple of console.log events to the fnSetFilteringDelay function and make sure that they show up in the console when you start typing.
Allan
i found the error, i had an old example or something because
i had this line
[code]anControl = $( 'table.dataTables input', _that.fnSettings().aanFeatures.f );[/code]
instead of
[code]
anControl = $( 'input', _that.fnSettings().aanFeatures.f );
[/code]
cheers