1rosehip / jplist-es6

jPList is a JavaScript library for sorting, pagination and filtering of any HTML structure like DIVs, UL/LI, tables, etc.
https://www.jplist.org/
MIT License
83 stars 39 forks source link

Refresh is not working #59

Open amrography opened 4 years ago

amrography commented 4 years ago

Thank you for your great effort,

I am trying to update data-min and data-max for buttons-range-filter using javascript, But the jplist is filtering with old values

html

<button data-jplist-control="buttons-range-filter" data-selected="true" data-group="group" data-name="filter-1" data-path=".date">Clear duration</button>
<button id="filter-date-btn" class="d-none" data-jplist-control="buttons-range-filter" data-group="group" data-name="filter-1" data-path=".date" data-min="1585692000" data-max="1590530399"></button>

<div class="list-group" data-jplist-group="group">
   <div class="list-group-item" data-jplist-item>
        <span class="date">1585692000</span>
    </div>
</div>

$(document).ready(function() {
jplist.init();

let $btn = $('#filter-date-btn')[0];

    $btn.setAttribute('data-min', 1585692001)
    $btn.setAttribute('data-max', 1585692002)

    jplist.refresh()

   $btn.click();

/* I ALSO TRIED THIS
    $btn.dispatchEvent(new MouseEvent("click", {
        bubbles: true,
        cancelable: true,
        view: window
    }))
*/
});