[ServerSide] add fnFilter on a td with fnRowCallback

[ServerSide] add fnFilter on a td with fnRowCallback

dazelldazell Posts: 17Questions: 0Answers: 0
edited January 2010 in General
Hi evryone,

I used to apply an "fnfilter" option when clicking an a "td" of a row, but since I'm using ServerSideprocessing, I try to do this with "fnRowCallback" like this :

[code] "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
$('td:eq(2)').click(function() {
oTable.fnFilter(aData[4]);
document.getElementById('search_table').value =aData[4];
});
return nRow;
}[/code]

but it don't work and nothing hapen ... did someone try to do this ?

regards, Val

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Val
  • dazelldazell Posts: 17Questions: 0Answers: 0
    edited January 2010
    I try
    [code]

    $('td', nRow).click(function() {
    oTable.fnFilter(this.innerHTML);
    });
    [/code]
    but it don't seems to work.

    Otherwise I used to apply some functions to my row before using fnrowcallback for instance :

    - a javascript function to play an mp3, but this code don't work :
    [code]
    $('td:eq(0)', nRow).click(function(event){
    loadFile('http://www.youtube.com/watch%3Fv%3D'+aaData[5]);
    DisplaySongInfo(aaData[1],aaData[2],aaData[3]);
    });
    [/code]


    - a php function wich display an image according to aaData[5]. I try to apply this function in my serverside.php :
    [code]
    function id_to_avatar ($id,$size,$DisplayName)
    {
    if ($size==''){$size=33;}
    if ($DisplayName){$name=id_to_username($id);}

    $avatar='

    '.$name.'';
    return $avatar;
    }

    $avatar2 = id_to_avatar($aRow['user'],'',false);
    $sOutput .= '"'.addslashes($avatar2).'",';
    [/code]
    but I don't know where to call this function, should I re-write it in javascript ?

    regards, Val
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Val
  • dazelldazell Posts: 17Questions: 0Answers: 0
    Ok, my fault !
    two errors : aaData instead of aData and indeed oTable.fnFilter instead of fnfilter !
    So thanks a lot, fnfilter and js functions works.
    Now I'm try to re-apply jeditable with [code]$('td', nRow).addClass('editable');[/code] ...
  • dazelldazell Posts: 17Questions: 0Answers: 0
    edited January 2010
    Ok, jeditable works fine with fnRowCallback,

    now I'm wondering why fnfilter doesn't works with regex and just on one column :
    [code]oTable.fnFilter("^"+aData[4]+"$",4,false);[/code]

    problem with server_side processing ?
    any suggestion ?
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi dazell,

    If you are doing server-side processing, then have you added the required logic (presumably in SQL) to do regex? If not - then that's the problem :-). All the filter processing is done at the server-side, so it needs to cope with that. bEscapeRegex_(int) is sent for each column to tell the server-side if it should escape or not regex characters.

    Regards,
    Allan
This discussion has been closed.