Custom search implementation - using OOB search field.

Custom search implementation - using OOB search field.

rgavrilovrgavrilov Posts: 13Questions: 6Answers: 0
edited July 2015 in Free community support

I want to use OOB search field, but I do not want stock (Global filter) to execute filtering.

I connected datatables to a knockout.js view model, and I want to flush filter cache (_aFilterRow / _sFilterRow) without redrawing the rows.

I did try using rows().invalidate() but, as I said, that has undesirable side effects.

Not sure if this would be a good solution, but being able to call something like rows().invalidateFilterCache() would do it for me.

Here is my present solution:

                    // HACK: datagrid does not watch individual fields. So there is no way to refresh
                    // searchable content (stored in _aFilterData array). Here we access private variable where
                    // cached serachable content is stored, and reset it, forcing DataTables to build it.
                    dt.rows().iterator("row", function (settings, row) {
                        settings.aoData[row]._sFilterRow = null;
                    });
                    dt.draw();

Even better solution would be to disable default filter, so I can implement custom filter using settings.oPreviousSearch.sSearch. I can't find a way to accomplish that without changing DT source code.

This discussion has been closed.