DataTable Column Filtering using a multiselect.

DataTable Column Filtering using a multiselect.

binro01binro01 Posts: 6Questions: 0Answers: 0
edited July 2012 in General
Hello all,

I'm trying to get DataTable to work with a jQuery MultiSelect Widget.

I'm able to render the tool nicely in the footer of the DataTable and on selecting one item in the multiSelect, The dataTable properly filters.

When I select more then one item from the multiSelect, an array of the Values selected is passed which causes my call to fail.

below is the code I'm running. (I left out the fnCreateSelect and fnGetColumnData, for they are pretty much identical to the example on the site)

The $(this).val() is passed an array of values from the multiSelect ( example 1,4,7 ) that I want to be able to find in the column in question and draw the table.

Any help with a JavaScript / DataTable novice will be much appreciated.

[code]
var oTable = $('#part').dataTable({
"sPaginationType": "full_numbers",
"sDom": 'lrtip',
"fnDrawCallback": function() {
$('#contents a[tooltip]').each(function()
{
$(this).qtip({
content: $(this).attr('tooltip'),
style: {
width: 300,
height: 210,
border: {
radius: 2,
color: 'black'
}
},
position: {
corner: {
target: 'topLeft',
tooltip: 'leftBottom'
}
}
});
});
}
}).columnFilter({
sPlaceHolder: "head:after",
aoColumns: myColumnsArray
});

$("tfoot th").each( function ( i ) {
this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
$('select', this).change( function () {
var myValue = $(this).val();
if (myValue == null)
{
myValue = '';
}
oTable.fnFilter( myValue, i );
} );
} );
[/code]

Replies

  • binro01binro01 Posts: 6Questions: 0Answers: 0
    I have the tool working well now. You can close the discussion if you wish.

    Below is the custom filtering I do on a table redraw.

    [code]
    $.fn.dataTableExt.afnFiltering.push(
    function( oSettings, aData, iDataIndex ) {
    var returnFlg = '';
    iLen=myValue.length;
    if (iLen == 0)
    {
    returnFlg = 'Y';
    }
    else
    {
    if (isNaN(aData[myCol])==true)
    {
    var iVersion = aData[myCol];
    var myString=iVersion;
    for ( i=0 ; i
This discussion has been closed.