fnfilter not refreshing the table

fnfilter not refreshing the table

tlnltlnl Posts: 13Questions: 0Answers: 0
edited October 2011 in General
I am using fnfilter and I do not see that the table is getting refreshed. I added the fndraw at the end too but no luck.
I viewed the text and its correct
I viewed the value of tabletofilter and selector is the name of my datatable


var obj, tableToFilter, colToFilter;

$('#btnFilter').click(function () {
tblFilter(filterText, oTable, 0);
});

function tblFilter(obj, tableToFilter, colToFilter) {

var val = $(obj).val();
if (val == "All") {
tableToFilter.fnFilter("(.*)", colToFilter, false);
tableToFilter.fnDraw();
} else {
tableToFilter.fnFilter("^" + val + "*" , colToFilter, false);
}
}


Am I missing something causing it not to refresh?


/* Initialize table and make first column non-sortable*/
oTable = $('#salespeople').dataTable({
"bProcessing": true,
"bJQueryUI": true,
"bServerSide": true,
"bLengthChange": true,
"bPaginate": false,
"bFilter": false,
"sAjaxSource": '/Manage/GetSales',
"aoColumns": [
null,
null,
null,
null,
null,
{ "bSortable": false, "bSearchable": false,
"fnRender": function (oObj) {
return '';
}
}


]
});

Replies

  • tlnltlnl Posts: 13Questions: 0Answers: 0
    If anyone can please tell me what I am doing wrong that the table is not refreshing.
    I see it stepping through the method all the values are right.
    The columns start with 0 and I tried with regular expr and without.

    Thanks again
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    in order for fnFilter to work with bServerSide, your server side script needs to apply the filter. This means your server side script needs to have logic to filter out your records. Does your script perform this?
  • tlnltlnl Posts: 13Questions: 0Answers: 0
    no. I thought fnfilter will filter the current data loaded in the grid
    What does fnfilter do?
    Basically I could just call a new method to query with the filter and rebind the grid.
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    edited October 2011
    fnFilter requests filtering. if you are using a source method other than server side, all the data is loaded and it filters based on all your data. but server side data's model is to only send to the client data for a page at a time. In order for things to work properly, filtering, sorting, etc., all have to be done in the server side script.

    calling fnFilter() with bServerSide true will do nothing on it's own, just request for the server script to filter your data. if your server side script doesn't perform the filtering, you'll see no change in the data.
This discussion has been closed.