Skip to content

Instantly share code, notes, and snippets.

@krizajb
Last active December 12, 2019 15:31
Show Gist options
  • Save krizajb/960e5962802a0ef41bee23c02689fcb9 to your computer and use it in GitHub Desktop.
Save krizajb/960e5962802a0ef41bee23c02689fcb9 to your computer and use it in GitHub Desktop.
function filterList(componentName, label, filter) {
let component = PF(componentName),
itemLabel = label.toLocaleLowerCase(),
item = $(component.items)
.filter(function () {
return $(this).data('label').toString().toLocaleLowerCase() === itemLabel;
})
.first();
if (item === undefined) {
return false;
}
let value = $(item.children().last()).html().toString().trim().toLocaleLowerCase();
return value.startsWith(filter);
}
function filterApplicant(label, filter) {
return filterList('widget_mainTab_applicantForm_countryCodeApplicant', label, filter);
}
<p:selectOneMenu
filter="true"
filterFunction="filterApplicant">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment