ColumnFilter and state saving

ColumnFilter and state saving

shiftymccoolshiftymccool Posts: 19Questions: 1Answers: 0
edited December 2013 in General
Hello all! First of all, I love datatables... best documentation ever!

I'm not sure if this should be in the columnfilter forum or this one, so I figured I would try here first.
I'm using the columnfilter plugin with datatables and bstatesave to a cookie. When I change a filter on a columnfilter generated field, it filters correctly. When I reload the page, the table is still filtered (sometimes incorrectly) but there is no way to re-filter (filter select lists are empty, etc..). The datatables info line still shows that the correct number of results are being received via ajax ("Showing 0 to 0 of 0 entries (filtered from 26 total entries)").
Any help with this will be much appreciated. Let me know if I'm in the wrong place. My datatables init code is below, thanks!:

[code]
var anOpen = [];
var activityCategories = [];
var sImageURL = "/assets/img/";

var activitiesTable = $('#activitiesGrid').dataTable( {
"bProcessing": true,
"sAjaxSource": "/recruiters/ajax/jsonresponse/getGeneralActivities.cfm",
"bDeferRender": true,
"sPaginationType": "full_numbers",
"sDom": '<"top"lp>rt<"bottom"i><"clear">',
"oLanguage": {
"sSearch": "Filter records:",
"sLengthMenu": "Show:
_MENU_"
},
"aLengthMenu": [[5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,-1], [5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,"All"]],
"bStateSave": true,
"iCookieDuration": 2592000, //1 month in seconds
"aoColumns": [
{
"mData": null,
"sClass": "control center",
"sDefaultContent": ''
},
{ "mData": "activityDate" },
{ "mData": "activityUser" },
{ "mData": "category" },
{ "mData": "contactName" },
{ "mData": "results" }
],
"fnDrawCallback": function(){
// Set row highlighting on mouseover
$('table#activitiesGrid td').bind('mouseenter', function () {
$(this).parent().children().each(function(){
$(this).addClass('datatablerowhighlight');
});
});

$('table#activitiesGrid td').bind('mouseleave', function () {
$(this).parent().children().each(function(){
$(this).removeClass('datatablerowhighlight');
});
});
},
"fnStateSaveParams": function (oSettings, oData) {
oData.iStart = 0; //Don't save start page, start at page 1 on every load
oData.iEnd = oData.iLength; //Set end element to the number of elements on page so page 1 ends appropriately
}
});


activitiesTable.columnFilter({
sPlaceHolder: "head:before",
sRangeFormat: "{from}{to}",
aoColumns: [
null,
{ type: "date-range" },
{ type: "select" },
{ type: "select" },
{ type: "select" },
{ type: "text" }
]
});

$('#activitiesGrid td.control').live( 'click', function () {
var nTr = this.parentNode;
var i = $.inArray( nTr, anOpen );

if ( i === -1 ) {
$('img', this).attr( 'src', sImageURL+"details_close.png" );
var nDetailsRow = activitiesTable.fnOpen( nTr, fnFormatDetails(activitiesTable, nTr), 'details' );
$('div.innerDetails', nDetailsRow).slideDown();
anOpen.push( nTr );
}
else {
$('img', this).attr( 'src', sImageURL+"details_open.png" );
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
activitiesTable.fnClose( nTr );
anOpen.splice( i, 1 );
} );
}
} );

function fnFormatDetails( activitiesTable, nTr )
{
var oData = activitiesTable.fnGetData( nTr );
var sOut =
''+
''+
'Note:'+oData.note+''+
''+
'';
return sOut;
}

[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    The columnFilter plug-in is third party and I don't know much about it so I can't offer much help I'm afraid. You might be best asking in that columnFilter's issue tracker.

    Allan
  • shiftymccoolshiftymccool Posts: 19Questions: 1Answers: 0
    edited December 2013
    No problem, I'll try there. Thanks!
This discussion has been closed.