Table will not redraw after filter or search

Table will not redraw after filter or search

smbstreamlinesmbstreamline Posts: 1Questions: 1Answers: 0

I have a table filled at page load with an array of data, and refreshed client-side using yadcf. I've now added a couple of checkboxes for showing/hiding Archived/Cancelled documents from the table.

The filtering callback seems to work fine, it detects the rows that have the searched for value and returns true/false appropriately. However, when I do table.draw(), nothing happens, ever... If I perform a table.order().draw(), it redraws fine, though.

    if (!$(filter).is(":checked")) {
        table.column('th.statuses').data().filter(function(value, index) {
            var text_value = '';
            var filterVal = $(filter).attr('value');

            $(value).find('option[selected="selected"]').each(function(key, item) {
                text_value += $(item).html();
            });

            if (filterVal == '') {
                return true;
            }

            var re = new RegExp(filterVal, 'ig');
            return text_value.match(re) != null ? true : false;
        }).draw();
    }

Do you have any idea why draw() isn't working?

This discussion has been closed.