niiknow / vue-datatables-net

Vue jQuery DataTables.net wrapper component
https://niiknow.github.io/vue-datatables-net/
MIT License
171 stars 58 forks source link

Individual column searching #15

Closed atiar-cse closed 4 years ago

atiar-cse commented 5 years ago

Hi,

Is there a way for - multi column searching like https://datatables.net/examples/api/multi_filter.html ?

Thanks & Regards!

noogen commented 5 years ago

The currently plugin implementation simply does server-side search for the value on all searchable fields. I have not done anything to make individual field filtering easier but you can definitely do it with datatables.net native way. Feel free to do a pull request if you want to make improvement on this plugin.

But based on the instruction you link, it's simply:

  1. On initComplete, render the filter fields on footer or header of the table for each column.
  2. Search field can either be filter by client-side or server-side by passing in query string for individual column as in, fname=blah&email=blah@blah. More details example on server-side searching with laravel datatables.net implementation: https://itsolutionstuff.com/post/custom-filter-search-with-laravel-datatables-exampleexample.html
        ajax: {
          url: ...,
          data: function (d) {
                d.email = $('.searchEmail').val(),
                d.fname = $('input[name="fname"]').val()
            }
        }
noogen commented 5 years ago

@atiar-cse Version 1.1.8 introduce tableCreating and tableCreated events, which should also help with this issue - https://github.com/niiknow/vue-datatables-net#events

dct24 commented 3 years ago

How to render the filter fields on header of the table for each column on initComplete or on table-created event?