Filtering with check boxes for serverside interactions

Filtering with check boxes for serverside interactions

slavaslava Posts: 3Questions: 0Answers: 0
edited December 2010 in Plug-ins
Aloha!

Let's say we take this example http://www.datatables.net/examples/server_side/server_side.html
as a base for serverside interactions.

How can we filter data with checkboxes? So basically I want to have a with few checkboxes and by using select function I want to be able to select 1 or more options for each column. Example below only shows how to do it for 1 parameter.


I did few other examples for Ajax, but I still couldn't figure out my question with checkboxes for filtering on serverside. This example as close as it gets http://www.datatables.net/examples/api/multi_filter_select.html


Thank you for all your help in advance =)
Awesome script!

Replies

  • slavaslava Posts: 3Questions: 0Answers: 0
    Is it super hard to do? If so can somebody do it for a fee?
  • slavaslava Posts: 3Questions: 0Answers: 0
    Come on folks, some assistance would be appreciated.
  • sebnapisebnapi Posts: 3Questions: 0Answers: 0
    I'm also interested in something like that, I thought about something like ColVis - checkboxes to change "bSearchable" to true and false. This would be great!
  • 28.vivek.s28.vivek.s Posts: 69Questions: 0Answers: 0
    i have did this but not for server side.............i am doing it on client side only....if you want this code then i can give you...
  • sebnapisebnapi Posts: 3Questions: 0Answers: 0
    Yeah, why not maybe its working fine, also with server-side.
  • 28.vivek.s28.vivek.s Posts: 69Questions: 0Answers: 0
    edited December 2010
    first of all i am initializing my table in ready method..
    [code]
    $('#filterimage'> img').bind('click',function(e){
    e.stopPropagation();
    fnCreatePopup( oTable.fnGetColumnData(n),vendorId,1 );
    /*where vendorId is column name and 1 is column no and filterimage is div id having image,and on click of that image i am calling a popup which is having checkboxes and some buttons.*/
    [/code]

    definition of fnGetColumnData is...
    [code]
    var container=""
    jQuery.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
    // check that we have a column id
    if ( typeof iColumn == "undefined" ) return new Array();

    // by default we only wany unique data
    if ( typeof bUnique == "undefined" ) bUnique = true;

    // by default we do want to only look at filtered data
    if ( typeof bFiltered == "undefined" ) bFiltered = true;

    // by default we do not wany to include empty values
    if ( typeof bIgnoreEmpty == "undefined" ) bIgnoreEmpty = true;

    // list of rows which we're going to loop through
    var aiRows;

    // use only filtered rows
    if (bFiltered == true) aiRows = oSettings.aiDisplay;
    // use all rows
    else aiRows = oSettings.aiDisplayMaster; // all row numbers

    // set up data array
    var asResultData = new Array();

    for (var i=0,c=aiRows.length; i -1) continue;

    // else push the value onto the result data array
    else asResultData.push(sValue);
    }

    return asResultData;
    };
    //And fnCreatepopUp is

    function fnCreatePopup( aData, str,columnNumber )
    {
    jQuery("#"+str).remove();
    var Id="'"+str+"'"
    var r=''+str+'', i, iLen=aData.length;
    for ( i=0 ; i0){
    oTable.fnFilter([container],iColumn,false);//filtering the table with value of checked checkboxes
    //i think here you can write your own filtering logic with 1 or more parameters
    }
    else{
    oTable.fnFilter('',iColumn,false);
    }
    container = ""
    SaveState(str);
    jQuery('#'+str).hide();

    }
    [/code]

    check out this code.......may be it's work for you guys...
    let me know if you stuck any where....
    waiting for your replies...

    Thanks,
    Vivek
  • jimbob72jimbob72 Posts: 49Questions: 0Answers: 0
    edited March 2011
    Did this work for anyone? I am also looking for a way of filtering server-side with multiple checkboxes. I'm trying to create an array in the server_processing.php script, something like:

    [code]/* Individual column filtering */

    /*got to figure this bit out - using example of sSearch_2 with multpiple values in string*/
    foreach ( $_GET['sSearch_2'] as $keyname => $value)
    {
    $searcharray .= ' '.$value.',';
    }

    for ( $i=0 ; $i
This discussion has been closed.