Adding individual column filtering using select menus table for ajax processing

Adding individual column filtering using select menus table for ajax processing

sidhxsidhx Posts: 5Questions: 0Answers: 0
edited August 2013 in General
hi guys,

Need know how to fetch select menu from other table for ajax processing along with search input to change the table view.I download example code didn't find any similar to my problem can give me any link code or guide or sample code on this matter.
Need have select box near to search input field.Currently works with normal server-side processing but need to get select menu with ajax processing.
[code] oTableLeague = $('.dTableLeague').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "league_processing.php",
"sPaginationType": "full_numbers",
"oLanguage": {"sSearch": "Search :" },
"aoColumns": [ { "sClass": "center" },
null,
{ "sClass": "center" },
{"sClass": "center", "bSortable": false },
{ "sClass": "center tableActs", "bSortable": false }],
"aaSorting": [[0, 'asc']]});[/code]

processing file is this
[code]
$aColumns = array( 'id', 'name','`group`','description','year', 'sport', 'startdate','enddate');

/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "id";

/* DB table to use */
$sTable = "`leagues` LEFT JOIN sports ON sports.sportid=leagues.sportid";
// this table to fetch data for table
....
[/code]
but i need one more table to select from 'sports' table for populating the select menu box.
then processing table should be
[code]$sTable = "`leagues` WHERE leagues.sportid = '$selectedsportid'";[/code]
how to do it..

Many thanks in advance!

Replies

  • sidhxsidhx Posts: 5Questions: 0Answers: 0
    hey screenshot http://snowtint.com/datatable/datatable.png
  • sidhxsidhx Posts: 5Questions: 0Answers: 0
    hey,

    [code]
    $(document).ready(function() {

    oTableLeague = $('.dTableLeague').dataTable( {

    "bFilter": true,
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "league_processing.php",
    "sPaginationType": "full_numbers",
    "bDeferRender": true,
    "oLanguage": {
    "sSearch": "Search :"
    },
    "iDisplayLength": "10",
    "aoColumns": [ { "sClass": "center" },
    null,
    { "sClass": "center" },
    {"sClass": "center", "bSortable": false },
    { "sClass": "center tableActs", "bSortable": false }],

    "fnInitComplete": function(oSettings, json) {
    // alert("oSettings.aiDisplay::"+oSettings.aiDisplay);

    $("#renderingSportFilter").each( function ( i ) {

    this.innerHTML = fnCreateSelect( oTableLeague.fnGetColumnData(1)); //1
    $('select', this).change( function () {
    oTableLeague.fnFilter( $(this).val(), 1 );
    } );
    } );
    }
    } )

    } );
    [/code] able to get details
    but for sports name i need hide sports id so that i can pass using select option like this
    Horse Racing
    Soccer
    Ice Hockey
    Rugby
    Golf
    Tennis
    but currently getting this
    Horse Racing
    Soccer
    Ice Hockey
    Rugby
    Golf
    Tennis
    this because im can't able send sportsid how can i do it...
  • sidhxsidhx Posts: 5Questions: 0Answers: 0
    [code]
    "aoColumns": [ /* Sl. No. */ { "bSearchable": false,"sClass": "center" },
    /* Sport Name */ {"bSearchable": true},
    /* Group Name */ { "sClass": "center" },
    /* Description */ {"sClass": "center", "bSortable": false },
    /* Action */ { "bSearchable": false,"sClass": "center tableActs", "bSortable": false },
    /* Sport id */ {"bVisible": false }], [/code]

    Need to get
    Sportname

    ex: Soccer
    how to do it
  • sidhxsidhx Posts: 5Questions: 0Answers: 0
    tried doing this not working [code] $("#renderingSportFilter").each( function ( i ) {

    this.innerHTML = fnCreateSelect( oTableLeague.fnGetColumnData(1)); //1
    sportid = fnCreateSelect( oTableLeague.fnGetColumnData(5)); //1
    $('select', this).change( function () {
    oTableLeague.fnFilter($('sportid').val() ,$(this).val() );
    } );
    } );[/code]
This discussion has been closed.