alfajango / jquery-dynatable

A more-fun, semantic, alternative to datatables
http://www.dynatable.com
Other
2.78k stars 363 forks source link

Partial query on a column #280

Open dnsBlah opened 7 years ago

dnsBlah commented 7 years ago

Hi all,

I'm using dyntable for a while now. And now I like to do a query on a column.

I used to do something like:

$('#search-location').change( function() {
        var value = $(this).val();
        if (value === "")
            dynatable.queries.remove("location");
        else
            dynatable.queries.add("location",value);

        dynatable.process();
    });

But now I have multiple locations stated in this column seperated by ... anything ... and it doesn't show any record with multiple locations when I change search-location.

machwatt commented 7 years ago

You might solve this via own queries. Have a look into the documentation/querying part.

.bind('dynatable:init', function(e, dynatable) {
    dynatable.queries.functions['location'] = function(record, queryValue) {
        return record.location.indexOf(queryValue) >= 0;
    };
 })