Adding data-filter to list in depending on number of listitems
I intend to add a data-filter to a list only when a rest service returns one or more items. Unfortunately when data-filter is checked in the Appery list component, and no items are returned, the data-filter still shows up.
For my project using old libraries I was executing the following JS on success of the service if one or more items were returned. Everything was working well and data-filter showed up only when one or more items were returned by the service.
if (!Appery("list").attr("data-filter")) {
Appery("list").listview('option', 'filter', true);
Appery("list").attr("data-filter", true);
Appery("list").listview("option", "filterPlaceholder", "Search Properties...");
Appery("list").trigger("listviewcreate");
}
I've just migrated to V2.0 and now the data-filter does not show up at all.
How can I fix this?
Thanks.