How to get the value of the attribute "Lazy" of the datatable primefaces in the bean?

Asked

Viewed 134 times

4

To get the attribute value selectionMode datatable (primefaces) in MB:

DataTable dt = (DataTable) FacesContext.getCurrentInstance().getViewRoot().findComponent("IdForm:IdDataTable");
String sm = dt.getSelectionMode();

And how do I get the attribute value lazy?

1 answer

2


To take any attribute of a JSF component just have an instance of the type UIComponent of the same, than with the method getAttributes() returns any desired attribute by passing only one key to the Map<String, Object>returned.

For your problem it can be used like this:

UIComponent dt = FacesContext.getCurrentInstance().getViewRoot().findComponent("IdForm:IdDataTable");
boolean lazy = (boolean)dt.getAttributes().get("lazy"));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.