Kuku
Kuku

Reputation: 514

How to find an component ID including the composite component ID from backing bean

Our project using PF5.1, we have a dataTable in a composite component. So after page rendering. the dataTable's id kind of like j_idt123:tableForm:tableId.

We need to clear the table filter stuff before searching. I tried use the following code to find it in the backing bean but it returns null.

FacesContext.getCurrentInstance().getViewRoot().findComponent("tableId");

As this component will be used in different xhtml file, this "j_idt123" thing got changed every time. What will be the right way to get the table ?

Upvotes: 0

Views: 472

Answers (1)

sinclair
sinclair

Reputation: 2861

"j_idt123" is a generated id for components which do not specify their own. Just give the parent-container of "tableForm" an id.

Upvotes: 1

Related Questions