Sorting the list with jPList button click
I am trying to sort a list using this jPList library.
The problem is the library does it with a choice that I don't like. I am trying to use a button to order my list.
Here on my JsFiddle you can see a demo I created, my list is larger but similar:
http://jsfiddle.net/Danny182/wsauumra/3/
I am using the .html function to insert inside the html the code they use in this page to sort the list. If I put manually inside the #sos div it works, but doing it with a button click and .html doesn't.
Can anyone help me?
$('.sortName').click(function () {
$('#sos').html('<div class="hidden" data-control-type="default-sort" data-control-name="sort" data-control-action="sort" data-path=".title" data-order="asc" data-type="text"> clicked </div>');
});
+3
source to share
2 answers
DECIDE:
using this code i had to call the function after the button was pressed:
http://jsfiddle.net/Danny182/wsauumra/4/
$('#demo').jplist({
itemsBox: '.list',
itemPath: '.list-item',
panelPath: '.jplist-panel'
});
$('.sortName').click(function () {
$('#sos').html('<div class="hidden" data-control-type="default-sort" data-control-name="sort" data-control-action="sort" data-path=".title" data-order="asc" data-type="text"> clicked </div>');
$('#demo').jplist({
itemsBox: '.list',
itemPath: '.list-item',
panelPath: '.jplist-panel'
});
});
0
source to share