fnFilterOnReturn doesn't work w/ server-side

fnFilterOnReturn doesn't work w/ server-side

ViperViper Posts: 9Questions: 0Answers: 0
edited October 2011 in DataTables 1.8
Hi!
I'm try to use this plugin. Filtering working good but event trigger for all keys not for only 'Enter'. In a past two hours I'm trying to unbind all key events for filtering input but with no succes. And in this plugin on row _that.fnFilter(anControl.val()); fnFilter function doesn't accept the column filtering limit.

Any ideas?

PS! If you need code that I'm using please inform me.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    add this code to your project:

    http://www.datatables.net/plug-ins/api#fnFilterOnReturn
  • ViperViper Posts: 9Questions: 0Answers: 0
    fbas this code has been allready added, but nothing changes.

    This is my code.
    [code]var oTable, init_params;
    $.fn.dataTableExt.oApi.fnFilterOnReturn = function(oSettings){
    var _that = this;

    this.each(function(i){
    $.fn.dataTableExt.iApiIndex = i;
    var $this = this;
    var anControl = $('input', _that.fnSettings().aanFeatures.f);
    var chk = parseInt($("input.default_th:checked").val(), 10);

    anControl.unbind('keyup').bind('keypress', function(e){
    if (e.which == 13) {
    $.fn.dataTableExt.iApiIndex = i;
    _that.fnFilter(anControl.val(), chk);
    }
    });

    return this;
    });

    return this;
    };
    $.fn.dataTableExt.oApi.fnReloadAjax = function(oSettings, sNewSource, fnCallback, bStandingRedraw){
    if (typeof sNewSource != 'undefined' && sNewSource != null) {
    oSettings.sAjaxSource = sNewSource;
    }
    this.oApi._fnProcessingDisplay(oSettings, true);
    var that = this;
    var iStart = oSettings._iDisplayStart;

    oSettings.fnServerData(oSettings.sAjaxSource, [], function(json){
    that.oApi._fnClearTable(oSettings);

    for (var i=0 ; i
  • ov3rhearov3rhear Posts: 4Questions: 0Answers: 0
    if you have the "oLanguage" setting, it doesn't work, the same happens to me too.
  • ov3rhearov3rhear Posts: 4Questions: 0Answers: 0
    after trying some more I found out the problem is not the oLanguage setting, but in fact the problem is if you save the i18n settings in another file and use the sUrl setting of oLanguage:

    this works:
    "oLanguage": {

    "sSearch": "Filtrar"
    },

    this doesn't:
    "oLanguage": {
    "sUrl": "Content/i18n/dataTables_es.txt"

    },

    I guess using an external file for i18n forces the datatable to wait to read it before it displays the filter input box and the fnFilterOnReturn script executes before this file is read...
  • rukbatrukbat Posts: 5Questions: 0Answers: 0
    You have to call fnFilterOnReturn in fnInitComplete:

    [code]
    oTable = $("#list").dataTable({
    "bJQueryUI": true,
    [...]
    "fnInitComplete": function(oSettings, json) {
    oTable..fnFilterOnReturn();
    },
    [...]
    "sScrollY": "400px"
    });
    [/code]
This discussion has been closed.