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

[Question] about JPList refresh #50

Closed Lakhiii closed 5 years ago

Lakhiii commented 5 years ago

I am trying to feed a value to the input using Jquery.val() but the input filter does not trigger the Jplist refresh/update. After adding a space in that input filter triggers the Jplist refresh.

Tried adding the Jquery.trigger("keypress") to simulate the user key press but it still does not trigger the Jplist refresh. Does JPList has a way to refresh the list similar to data-clear-btn-id which clears the filters?

grovolis commented 5 years ago

@Lakhiii had the same issue, make sure you are using plain javascript for this to work otherwise the trigger even isn't working properly.

$('.tag.label').on("click", function() { var tag = $(this); var search = tag.data("search"); var searchBox = document.getElementById('search-site-names'); searchBox.value = search; searchBox.dispatchEvent(new KeyboardEvent('keyup',{'key':'a'})); });

Lakhiii commented 5 years ago

@grovolis it worked!! thanks very much for the solution really helped a lot!