Hello,
I want to be able to filter list item with a button.
Here is an example:
As you can see: three buttons outside of the list. The first button shows ALL the messages, the second one only the messages that have been read by the user and the third the messages that have not been read by the user.
The data wether a user has read a message or not gets populated by a RESTservice. The value (1 for read and 0 for NOTread) is in every list item like so:
code
var dateFormat = $.datepicker.formatDate('dd-mm-yy', new Date(value.date));
element.children().remove();
if (value.read == 1)
{
element.append('<p class="ui-li-heading" value="1"</p>');
}else{
element.append('<img src="files/views/assets/image/new_msg.png" class="ui-li-thumb ui-corner-top">');
element.append('<p class="ui-li-heading" value="0"></p>');
}
/code
As you can see: in the P tag I have added a value attribute with value 1 or 0. How can I filter the items based on that value with the buttons above?
I've tried various ways with the filter method but without success.
Please advise!