Using fnfilter and global search

Using fnfilter and global search

QuentinQuentin Posts: 21Questions: 0Answers: 0
edited June 2012 in General
Hi,

fnFilter is working fine, but i am not able to use the basic global search anymore.

I provide the ability to my users to make a subselection on the data.
From this subselection, i got a list of ids that i put into fnfilter like this :
[code]
var tab=<?php echo htmlspecialchars(json_encode($_POST['idList']), ENT_NOQUOTES); ?>;
oTable.fnFilter(tab.join(","), 0);
[/code]

So tab looks like ["620","754","1283"], and fnFilter is getting a string like 620,754,1283.

I have modified server_processing.php to fit my data for fnFilter :
[code]
/* Individual column filtering */
for ( $i=0 ; $i

Replies

  • QuentinQuentin Posts: 21Questions: 0Answers: 0
    I changed
    [code]oTable.fnFilter(tab.join(","), 0)[/code]
    to
    [code]oTable.fnFilter(tab, 0, false,true,true,true);[/code]

    and
    [code]
    $arr = explode(",",$_GET['sSearch_'.$i]);
    $sWhere .= " ( ";
    for ( $i=0 ; $i
  • QuentinQuentin Posts: 21Questions: 0Answers: 0
    It looks like when tab is small it's working, and when it contains 250 ids ( 1, 1285, etc...) it doesn't.

    Is there a size limit somewhere (fnfilter) ?
    I can email debug link to interested people.

    Thanks
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    There is no size limit applied in the filtering in DataTables. If it isn't working - what I would suggest is printing out the SQL that is being constructed and just making sure that it is what you would expect it to be based on a given input.

    Allan
  • QuentinQuentin Posts: 21Questions: 0Answers: 0
    In fact, i already checked the sql query.
    The $sWhere is empty when there's a lot of row.

    To be sure, i bypassed the search and the filtering code, and put [code] id = ANY(ARRAY[".$_GET['sSearch_0]."])[/code] in $sQuery before calling pg_query.

    sSearch_0 contains the ids (checked in firebug), but $sSearch_0 is empty in $sQuery.

    Also, I tried to use fnserverparams to pass ids in another way than fnfilter, like this :
    [code]
    oTable = $('#example').dataTable( {
    ...
    "fnServerParams": function ( aoData ) {
    /* Add some extra data to the sender */
    aoData.push( { "name": "id", "value": tab } )
    }
    ...
    });
    [/code]
    where tab is 1,2,3,4...

    In firebug, i see that GET request to server_processing.php contain id=1,2,3,4
    But in my php script on server side, there is no $_GET['id'] set.

    Am I getting fnServerParams data the right way with $_GET['id'] ?
This discussion has been closed.