alfajango / jquery-dynatable

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

Multiple select and input search #293

Closed hypesol closed 6 years ago

hypesol commented 6 years ago

I am trying to search with selectbox in non-table but i am getting error" Cannot read property 'length' of null".

Below is my code the field name which I want to use for search in json is "bank_name". Please guide me how can I use select box for search.

`

</div>`

function ulWriter(rowIndex, record, columns, cellWriter) { var cssClass = "col-xs-4", li; if (rowIndex % 3 === 0) { cssClass += ' first'; } li = '<li class="' + cssClass + '"><div class="thumbnail"><div class="thumbnail-image">' + record.bank_name + '</div><div class="caption">' + record.location_city + '</div><div>' + exts + '</div></div></li>'; return li; }

`var dynatable = $('#ul-example') .dynatable({ features: { paginate: true, recordCount: true, sorting: true }, table: { bodyRowSelector: 'li' }, dataset: { perPageDefault: 3, perPageOptions: [3, 6], records: banks }, inputs: { queries: $('#search-bank') }, writers: { _rowWriter: ulWriter }, params: { records: 'Banks' } }).data('dynatable');

    $('#search-bank').change(function() {
        var value = $(this).val();
        if (value === "") {
            dynatable.queries.remove("bank_name");
        } else {
            dynatable.queries.add("bank_name", value);
        }
        dynatable.process();
    });`
zurmoehle commented 6 years ago

Hi there, can someone tell me why this issue s closed? I have the same problem and would like to know how to fix it.